Skip to content

Commit

Permalink
Several adjustments (#10539)
Browse files Browse the repository at this point in the history
Add names for new entities
Allow new entities to open doors
Move holiday effects to client config
  • Loading branch information
Raycoms authored Dec 22, 2024
1 parent 60a8933 commit f8aac52
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ default ResourceLocation getTexture(@NotNull final AbstractEntityCitizen entityC
{
if (cachedHalloweenStyle == null)
{
if (MineColonies.getConfig().getServer().holidayFeatures.get() &&
if (MineColonies.getConfig().getClient().holidayFeatures.get() &&
((LocalDateTime.now().getDayOfMonth() >= 29 && LocalDateTime.now().getMonth() == Month.OCTOBER)
|| (LocalDateTime.now().getDayOfMonth() <= 2 && LocalDateTime.now().getMonth() == Month.NOVEMBER)))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class ClientConfiguration extends AbstractConfiguration
public final ForgeConfigSpec.IntValue neighborbuildingrange;
public final ForgeConfigSpec.IntValue buildgogglerange;
public final ForgeConfigSpec.BooleanValue colonyteamborders;
public final ForgeConfigSpec.BooleanValue holidayFeatures;

/**
* Builds client configuration.
Expand All @@ -26,6 +27,7 @@ protected ClientConfiguration(final ForgeConfigSpec.Builder builder)
neighborbuildingrange = defineInteger(builder, "neighborbuildingrange", 4, -2, 16);
buildgogglerange = defineInteger(builder, "buildgogglerange", 50, 1, 250);
colonyteamborders = defineBoolean(builder, "colonyteamborders", true);
holidayFeatures = defineBoolean(builder, "holidayfeatures", true);

swapToCategory(builder, "pathfinding");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public class ServerConfiguration extends AbstractConfiguration
public final ForgeConfigSpec.BooleanValue enableInDevelopmentFeatures;
public final ForgeConfigSpec.BooleanValue alwaysRenderNameTag;
public final ForgeConfigSpec.BooleanValue workersAlwaysWorkInRain;
public final ForgeConfigSpec.BooleanValue holidayFeatures;
public final ForgeConfigSpec.IntValue luckyBlockChance;
public final ForgeConfigSpec.IntValue minThLevelToTeleport;
public final ForgeConfigSpec.DoubleValue foodModifier;
Expand Down Expand Up @@ -132,7 +131,6 @@ protected ServerConfiguration(final ForgeConfigSpec.Builder builder)
enableInDevelopmentFeatures = defineBoolean(builder, "enableindevelopmentfeatures", false);
alwaysRenderNameTag = defineBoolean(builder, "alwaysrendernametag", true);
workersAlwaysWorkInRain = defineBoolean(builder, "workersalwaysworkinrain", false);
holidayFeatures = defineBoolean(builder, "holidayfeatures", true);
luckyBlockChance = defineInteger(builder, "luckyblockchance", 1, 0, 100);
minThLevelToTeleport = defineInteger(builder, "minthleveltoteleport", 3, 0, 5);
foodModifier = defineDouble(builder, "foodmodifier", 1.0, 0.1, 100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.Tuple;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.*;
Expand Down Expand Up @@ -178,15 +177,12 @@ public AbstractAdvancedPathNavigate getNavigation()
this.navigation = newNavigator;
this.newNavigator.setCanFloat(true);
newNavigator.setSwimSpeedFactor(getSwimSpeedFactor());
this.newNavigator.getPathingOptions().setEnterDoors(true);
newNavigator.getPathingOptions().setEnterDoors(true);
newNavigator.getPathingOptions().setCanOpenDoors(true);
newNavigator.getPathingOptions().withDropCost(1D);
newNavigator.getPathingOptions().withJumpCost(1D);
newNavigator.getPathingOptions().setPassDanger(true);
PathingStuckHandler stuckHandler = PathingStuckHandler.createStuckHandler()
.withTakeDamageOnStuck(0.4f)
.withBuildLeafBridges()
.withChanceToByPassMovingAway(0.20)
.withPlaceLadders();
PathingStuckHandler stuckHandler = PathingStuckHandler.createStuckHandler();

if (MinecoloniesAPIProxy.getInstance().getConfig().getServer().raidersbreakblocks.get())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
import com.minecolonies.api.enchants.ModEnchants;
import com.minecolonies.api.entity.CustomGoalSelector;
import com.minecolonies.api.entity.ai.combat.threat.IThreatTableEntity;
import com.minecolonies.api.entity.pathfinding.registry.IPathNavigateRegistry;
import com.minecolonies.api.items.IChiefSwordItem;
import com.minecolonies.api.util.ColonyUtils;
import com.minecolonies.api.util.DamageSourceKeys;
import com.minecolonies.core.entity.pathfinding.navigation.AbstractAdvancedPathNavigate;
import com.minecolonies.core.entity.pathfinding.navigation.PathingStuckHandler;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.DifficultyInstance;
Expand Down Expand Up @@ -171,6 +173,37 @@ public AbstractEntityMinecoloniesRaider(final EntityType<? extends AbstractEntit
RaiderMobUtils.setEquipment(this);
}

@NotNull
@Override
public AbstractAdvancedPathNavigate getNavigation()
{
if (this.newNavigator == null)
{
this.newNavigator = IPathNavigateRegistry.getInstance().getNavigateFor(this);
this.navigation = newNavigator;
this.newNavigator.setCanFloat(true);
newNavigator.setSwimSpeedFactor(getSwimSpeedFactor());
newNavigator.getPathingOptions().setEnterDoors(true);
newNavigator.getPathingOptions().withDropCost(1D);
newNavigator.getPathingOptions().withJumpCost(1D);
newNavigator.getPathingOptions().setPassDanger(true);
PathingStuckHandler stuckHandler = PathingStuckHandler.createStuckHandler()
.withTakeDamageOnStuck(0.4f)
.withBuildLeafBridges()
.withChanceToByPassMovingAway(0.20)
.withPlaceLadders();

if (MinecoloniesAPIProxy.getInstance().getConfig().getServer().raidersbreakblocks.get())
{
stuckHandler.withBlockBreaks();
stuckHandler.withCompleteStuckBlockBreak(6);
}

newNavigator.setStuckHandler(stuckHandler);
}
return newNavigator;
}

@Override
public boolean removeWhenFarAway(final double distanceToClosestPlayer)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ public ItemStack getDisplayArmor(final EquipmentSlot equipmentSlot)
{
if (cachedDisplaySantaHat == null)
{
if (MineColonies.getConfig().getServer().holidayFeatures.get() && LocalDate.now(Clock.systemDefaultZone()).getMonth() == Month.DECEMBER)
if (MineColonies.getConfig().getClient().holidayFeatures.get() && LocalDate.now(Clock.systemDefaultZone()).getMonth() == Month.DECEMBER)
{
cachedDisplaySantaHat = new ItemStack(ModItems.santaHat);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ public static void onWorldLoad(@NotNull final LevelEvent.Load event)

// Global events
// Halloween ghost mode
if (event.getLevel().isClientSide() && MineColonies.getConfig().getServer().holidayFeatures.get() &&
if (event.getLevel().isClientSide() && MineColonies.getConfig().getClient().holidayFeatures.get() &&
(LocalDateTime.now().getDayOfMonth() == 31 && LocalDateTime.now().getMonth() == Month.OCTOBER
|| LocalDateTime.now().getDayOfMonth() == 1 && LocalDateTime.now().getMonth() == Month.NOVEMBER
|| LocalDateTime.now().getDayOfMonth() == 2 && LocalDateTime.now().getMonth() == Month.NOVEMBER))
Expand Down
75 changes: 72 additions & 3 deletions src/main/resources/assets/minecolonies/lang/manual_en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1842,11 +1842,13 @@
"death.attack.entity.minecolonies.amazon": "%s was pierced by an Amazon's arrow",
"entity.amazonspearman": "Amazon Spearman",
"entity.minecolonies.amazonspearman": "Amazon Spearman",
"death.attack.entity.minecolonies.amazonspearman": "%s was pierced by an Amazon's spear",
"death.attack.entity.minecolonies.spear": "%s was perforated by a spear",

"entity.amazonchief": "Amazon Leader",
"entity.minecolonies.amazonchief": "Amazon Leader",
"death.attack.entity.minecolonies.amazonchief": "%s was expelled by the great Amazon Leader",
"death.attack.entity.minecolonies.amazonspearman": "%s was pierced by an Amazon's spear",
"death.attack.entity.minecolonies.amazon": "%s was pierced by an Amazon's arrow",
"death.attack.entity.minecolonies.spear": "%s was perforated by a spear",

"com.minecolonies.coremod.job.mechanic": "Mechanic",
"com.minecolonies.coremod.gui.workerhuts.plantation.to_plant": "Planting:",
Expand Down Expand Up @@ -2770,5 +2772,72 @@

"com.minecolonies.coremod.diseases.influenza": "Influenza",
"com.minecolonies.coremod.diseases.measles": "Measles",
"com.minecolonies.coremod.diseases.smallpox": "Smallpox"
"com.minecolonies.coremod.diseases.smallpox": "Smallpox",

"entity.campamazon": "Amazon",
"entity.acampmazonspearman": "Amazon Spearman",
"entity.campamazonchief": "Amazon Leader",

"entity.minecolonies.campamazon": "Amazon",
"entity.minecolonies.campamazonspearman": "Amazon Spearman",
"entity.minecolonies.campamazonchief": "Amazon Leader",

"entity.minecolonies.campnorsemenchief": "Chief Norseman",
"entity.minecolonies.campnorsemenarcher": "Archer Norseman",
"entity.minecolonies.campshieldmaiden": "Shieldmaiden",

"entity.campnorsemenchief": "Chief Norseman",
"entity.campnorsemenarcher": "Archer Norseman",
"entity.campshieldmaiden": "Shieldmaiden",

"entity.campbarbarian": "Barbarian",
"entity.camparcherbarbarian": "Archer Barbarian",
"entity.campchiefbarbarian": "Chief Barbarian",

"entity.minecolonies.campbarbarian": "Barbarian",
"entity.minecolonies.camparcherbarbarian": "Archer Barbarian",
"entity.minecolonies.campchiefbarbarian": "Chief Barbarian",

"entity.camppirate": "Pirate",
"entity.camparcherpirate": "Archer Pirate",
"entity.campchiefpirate": "Pirate Captain",

"entity.minecolonies.camppirate": "Pirate",
"entity.minecolonies.camparcherpirate": "Archer Pirate",
"entity.minecolonies.campchiefpirate": "Pirate Captain",

"entity.campmummy": "Mummy",
"entity.camparchermummy": "Archer Mummy",
"entity.camppharao": "Pharaoh",

"entity.minecolonies.campmummy": "Mummy",
"entity.minecolonies.camparchermummy": "Archer Mummy",
"entity.minecolonies.camppharao": "Pharaoh",

"entity.minecolonies.campdrownedpirate": "Drowned Pirate",
"entity.minecolonies.campdrownedarcherpirate": "Drowned Pirate Archer",
"entity.minecolonies.campdrownedchiefpirate": "Drowned Pirate Chief",

"entity.campdrownedpirate": "Drowned Pirate",
"entity.campdrownedarcherpirate": "Drowned Pirate Archer",
"entity.campdrownedchiefpirate": "Drowned Pirate Chief",

"death.attack.entity.minecolonies.campbarbarian": "%s was sliced and diced by a Barbarian",
"death.attack.entity.minecolonies.campchiefbarbarian": "%s was macerated by a Great Chief",
"death.attack.entity.minecolonies.camparcherbarbarian": "%s was ravaged by an Archer Barbarian",
"death.attack.entity.minecolonies.camppirate": "%s was sliced and diced by a Pirate",
"death.attack.entity.minecolonies.campchiefpirate": "%s was macerated by a Pirate Captain",
"death.attack.entity.minecolonies.camparcherpirate": "%s was ravaged by an Archer Pirate",
"death.attack.entity.minecolonies.campmummy": "%s was scared to death by a Mummy",
"death.attack.entity.minecolonies.camppharao": "%s was put to sleep by a Pharaoh",
"death.attack.entity.minecolonies.camparchermummy": "%s was pierced by a Mummy's deadly glare",
"death.attack.entity.minecolonies.campamazonchief": "%s was expelled by the great Amazon Leader",
"death.attack.entity.minecolonies.campamazonspearman": "%s was pierced by an Amazon's spear",
"death.attack.entity.minecolonies.campamazon": "%s was pierced by an Amazon's arrow",
"death.attack.entity.minecolonies.campnorsemenchief": "%s was grounded by the great Viking Chief",
"death.attack.entity.minecolonies.campnorsemenarcher": "%s was hit by an Archer Viking",
"death.attack.entity.minecolonies.campshieldmaiden": "%s was crushed by a Shieldmaiden",
"death.attack.entity.minecolonies.campdrownedpirate": "%s was taken to the depths by a drowned Pirate",
"death.attack.entity.minecolonies.campdrownedarcherpirate": "%s was pierced from the depths by a drowned Pirate Archer",
"death.attack.entity.minecolonies.campdrownedchiefpirate": "%s was put to a watery grave by a drowned Pirate Chief"
}

0 comments on commit f8aac52

Please sign in to comment.