Skip to content

Commit

Permalink
Merge branch '1.19.2' into 1.19.3
Browse files Browse the repository at this point in the history
# Conflicts:
#	common/src/main/java/net/mca/entity/ai/brain/VillagerTasksMCA.java
  • Loading branch information
Luke100000 committed May 28, 2023
2 parents 59afbca + 0d21ac8 commit bf98402
Show file tree
Hide file tree
Showing 40 changed files with 289 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:

name: "[Universal ${{steps.split.outputs._1}}] MCA Reborn - ${{steps.split.outputs._0}}"
changelog-file: changelog.md
version-type: beta
version-type: release
files: build/libs/*-@(universal).jar
loaders: |
fabric
Expand Down
48 changes: 34 additions & 14 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 7.5.1

* Fixed a critical performance issue when childrens are stuck in a wall
* Disabled smarter door AI (which can open gates) by default due to reports of villagers not closing the door
* Added a few config flags for customizing the destiny screen

# 7.5.0

* Added experimental Skin library, editor and uploader
Expand Down Expand Up @@ -155,17 +161,21 @@
* Added tooltip to editor to avoid confusion when choosing vanilla model
* Fixed players also having randomly colored hair
* Several Changes to the Naming systems in MCA
* Player Naming has been fixed and works properly, much like how /nickname systems work (If you have an existing custom name, MCA will use that instead)
* It is no longer possible to have a whitespace/empty name, and multiple safeguards have been placed to prevent exploits.
* Player Naming has been fixed and works properly, much like how /nickname systems work (If you have an existing
custom name, MCA will use that instead)
* It is no longer possible to have a whitespace/empty name, and multiple safeguards have been placed to prevent
exploits.
* The `Nameless Traveler` code has been removed in favor of the above fix.
* Added a Homosexuality Trait as a possible chance to spawn with
* This trait cannot be inherited from past/to future generations
* Having this trait will enforce gender restrictions in Relationship Items and Villagers entering relations with those of the same gender
* Having this trait will enforce gender restrictions in Relationship Items and Villagers entering relations with
those of the same gender
* Due to this trait being available, some relationship items being gifted may result in `incompatible` responses.
* In the event of this trait being applied alongside the bisexual trait, the homosexual trait will take priority.
* Added `professionConversionsMap` as a config value, made for mod compatibility
* Designed to be able to use clothing from another profession, if your mod does not supply any to us
* Example: You can make a Butcher wear Armorer's clothing, or villagers wear a certain professions clothing by default.
* Example: You can make a Butcher wear Armorer's clothing, or villagers wear a certain professions clothing by
default.
* Only Adult clothing is used in this, baby and child clothing remains unchanged.
* Added `playerRendererBlacklist` to disable certain render elements of the player model if certain mods are present
* Supported Values: `arms`, `left_arm`, `right_arm`, `all`, `block_player`, `block_villager`
Expand All @@ -179,7 +189,8 @@
* The `canBeAttractedTo` checks for a Player/Villager relationship now properly respect traits
* IE the same logic that is used for villagers now also applies to players
* Added `shaderLocationsMap` to allow specifying custom shaders dependent on traits
* If the camera entity has the specified trait, it'll apply the shader, and remove it when the current camera entity does not.
* If the camera entity has the specified trait, it'll apply the shader, and remove it when the current camera entity
does not.
* Requires `enablePlayerShaders` to be true to utilize this feature
* Added functionality for `Lactose Intolerance`
* Applies a Poison effect after usage, similar to if a spider eye were consumed
Expand Down Expand Up @@ -214,8 +225,10 @@
# 7.3.17

* Fixed an issue with the Bone Meal Check in `HarvestingTask` not taking into account modded items
* Fixed an issue relating to a mismatched slot checked when a villager is left-handed and `HarvestingTask#bonemealCrop` was ran
* Rewritten `HarvestingTask#plantSeed` to allow modded plants to be properly planted, if specified in the `villager_plantable` tag and a valid `BlockItem`
* Fixed an issue relating to a mismatched slot checked when a villager is left-handed and `HarvestingTask#bonemealCrop`
was ran
* Rewritten `HarvestingTask#plantSeed` to allow modded plants to be properly planted, if specified in
the `villager_plantable` tag and a valid `BlockItem`
* This also fixes pumpkin and melon seeds not properly planting, despite being in the tag
* Added a `minBuildingSize` as a counterpart to the previously implemented `maxBuildingSize` config option
* I'm not sure why someone wanted this, but...ok.
Expand Down Expand Up @@ -270,20 +283,26 @@
* Sneaking + Interacting with a villager with the editor item will now open their inventory!
* Added Left-Handed Trait as a possible chance to spawn with
* This trait can be inherited from past/to future generations
* Having this trait will change their dominant hand in most tasks to be their left hand (Known to the player as the off-hand slot)
* Some examples of this include Work Tasks, EquipmentSet's, and Melee Attacks (For Equipment, if a preset already uses both hands, it'll remain unchanged.)
* Given Minecraft was never intended to support this type of gameplay, further tuning may be required in a future update.
* Having this trait will change their dominant hand in most tasks to be their left hand (Known to the player as the
off-hand slot)
* Some examples of this include Work Tasks, EquipmentSet's, and Melee Attacks (For Equipment, if a preset already
uses both hands, it'll remain unchanged.)
* Given Minecraft was never intended to support this type of gameplay, further tuning may be required in a future
update.

# 7.3.11/7.3.12

* Misc. Patches for 1.18.2 and 1.19 Dependencies (1.18.2 officially identifies as LTS now!)
* Added `innArrivalNotification` config setting, for notifying players in the village that a new traveller has arrived!
* Added a Night Owl schedule, in which Cultist's and Outlaws have a chance to use, based on the `nightOwlChance` config setting (Default: 50% Chance)
* Added a Night Owl schedule, in which Cultist's and Outlaws have a chance to use, based on the `nightOwlChance` config
setting (Default: 50% Chance)
* Enable `allowAnyNightOwl` to be able to apply this same chance to other professions
* Guard's will also now use `nightOwlChance` instead of using a random boolean to determine their schedule (Meaning if you want more guards at night, increase `nightOwlChance`)
* Guard's will also now use `nightOwlChance` instead of using a random boolean to determine their schedule (Meaning
if you want more guards at night, increase `nightOwlChance`)
* Added a Bisexuality Trait as a possible chance to spawn with
* This trait cannot be inherited from past/to future generations
* Having this trait will bypass gender restrictions in Relationship Items and Villagers entering relations with those of the same gender
* Having this trait will bypass gender restrictions in Relationship Items and Villagers entering relations with
those of the same gender
* Due to this trait being available, some relationship items being gifted may result in `incompatible` responses.

# 7.3.10
Expand Down Expand Up @@ -511,7 +530,8 @@
* Fixed letter author and creative mode usage
* Strengthened Grim Reaper
* Added mod support for atmospheric, autumity, berry good, buzzier bees, environmental, neopolitan, and upgrade aquatic
* Villager now recognize and estimate the value of every (modded) armor, tool, sword, bow and food as a gift (accuracy not guaranteed)
* Villager now recognize and estimate the value of every (modded) armor, tool, sword, bow and food as a gift (accuracy
not guaranteed)

# 7.0.7

Expand Down
3 changes: 3 additions & 0 deletions common/src/main/java/net/mca/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public static Config getInstance() {
public boolean showNotificationsAsChat = false;
public int heartsToBeConsideredAsFriend = 40;
public boolean enableVillagerMailingPlayers = true;
public boolean allowBodyCustomizationInDestiny = true;
public boolean allowTraitCustomizationInDestiny = true;

public float zombieBiteInfectionChance = 0.05f;
public float infectionChanceDecreasePerLevel = 0.25f;
Expand Down Expand Up @@ -92,6 +94,7 @@ public static Config getInstance() {
public int burnedClothingTickLength = 3600;
public float coloredHairChance = 0.02f;
public int heartsRequiredToAutoSpawnGravestone = 10;
public boolean useSmarterDoorAI = false;

//tracker
public boolean trackVillagerPosition = true;
Expand Down
61 changes: 39 additions & 22 deletions common/src/main/java/net/mca/client/gui/DestinyScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,28 @@ public void close() {

@Override
protected String[] getPages() {
return new String[] {"general", "body", "head", "traits"};
LinkedList<String> pages = new LinkedList<>();
pages.add("general");
if (Config.getInstance().allowBodyCustomizationInDestiny) {
pages.add("body");
pages.add("head");
}
if (Config.getInstance().allowTraitCustomizationInDestiny) {
pages.add("traits");
}
return pages.toArray(new String[]{});
}

@Override
public void renderBackground(MatrixStack matrices) {
assert MinecraftClient.getInstance().world != null;
renderBackgroundTexture((int)MinecraftClient.getInstance().world.getTime());
renderBackgroundTexture((int) MinecraftClient.getInstance().world.getTime());
}

private void drawScaledText(MatrixStack transform, Text text, int x, int y, float scale) {
transform.push();
transform.scale(scale, scale, scale);
drawCenteredText(transform, textRenderer, text, (int)(x / scale), (int)(y / scale), 0xffffffff);
drawCenteredText(transform, textRenderer, text, (int) (x / scale), (int) (y / scale), 0xffffffff);
transform.pop();
}

Expand All @@ -79,10 +88,11 @@ public void render(MatrixStack transform, int mouseX, int mouseY, float delta) {
DrawableHelper.drawTexture(transform, width * 2 - 512, -40, 0, 0, 1024, 512, 1024, 512);
transform.pop();
}
case "destiny" -> drawScaledText(transform, Text.translatable("gui.destiny.journey"), width / 2, height / 2 - 48, 1.5f);
case "destiny" ->
drawScaledText(transform, Text.translatable("gui.destiny.journey"), width / 2, height / 2 - 48, 1.5f);
case "story" -> {
List<Text> text = FlowingText.wrap(story.getFirst(), 256);
int y = (int)(height / 2 - 20 - 7.5f * text.size());
int y = (int) (height / 2 - 20 - 7.5f * text.size());
for (Text t : text) {
drawScaledText(transform, t, width / 2, y, 1.25f);
y += 15;
Expand Down Expand Up @@ -126,17 +136,23 @@ protected void setPage(String page) {
drawModel(width / 2 - DATA_WIDTH / 2, height / 2 + 24 + 22);

acceptWidget = addDrawableChild(new ButtonWidget(width / 2 - 32, height / 2 + 60 + 22, 64, 20, Text.translatable("gui.button.accept"), sender -> {
setPage("body");
if (Config.getInstance().allowBodyCustomizationInDestiny) {
setPage("body");
} else if (Config.getInstance().allowTraitCustomizationInDestiny) {
setPage("traits");
} else {
setPage("destiny");
}
}));
}
case "destiny" -> {
int x = 0;
int y = 0;
for (String location : Config.getServerConfig().destinySpawnLocations) {
int rows = (int)Math.ceil(Config.getServerConfig().destinySpawnLocations.size() / 3.0f);
int rows = (int) Math.ceil(Config.getServerConfig().destinySpawnLocations.size() / 3.0f);
float offsetX = (y + 1) == rows ? (2 - (Config.getServerConfig().destinySpawnLocations.size() - 1) % 3) / 2.0f : 0;
float offsetY = Math.max(0, 3 - rows) / 2.0f;
addDrawableChild(new ButtonWidget((int)(width / 2 - 96 * 1.5f + (x + offsetX) * 96), (int)(height / 2 + (y + offsetY) * 20 - 16), 96, 20, Text.translatable("gui.destiny." + new Identifier(location).getPath()), sender -> {
addDrawableChild(new ButtonWidget((int) (width / 2 - 96 * 1.5f + (x + offsetX) * 96), (int) (height / 2 + (y + offsetY) * 20 - 16), 96, 20, Text.translatable("gui.destiny." + new Identifier(location).getPath()), sender -> {
selectStory(location);
}));
x++;
Expand All @@ -146,20 +162,21 @@ protected void setPage(String page) {
}
}
}
case "story" -> addDrawableChild(new ButtonWidget(width / 2 - 48, height / 2 + 32, 96, 20, Text.translatable("gui.destiny.next"), sender -> {
//we teleport early here to avoid initial flickering
if (!teleported) {
NetworkHandler.sendToServer(new DestinyMessage(location));
MCAClient.getDestinyManager().allowClosing();
teleported = true;
}
if (story.size() > 1) {
story.remove(0);
} else {
NetworkHandler.sendToServer(new DestinyMessage(true));
super.close();
}
}));
case "story" ->
addDrawableChild(new ButtonWidget(width / 2 - 48, height / 2 + 32, 96, 20, Text.translatable("gui.destiny.next"), sender -> {
//we teleport early here to avoid initial flickering
if (!teleported) {
NetworkHandler.sendToServer(new DestinyMessage(location));
MCAClient.getDestinyManager().allowClosing();
teleported = true;
}
if (story.size() > 1) {
story.remove(0);
} else {
NetworkHandler.sendToServer(new DestinyMessage(true));
super.close();
}
}));
default -> super.setPage(page);
}
}
Expand Down
16 changes: 3 additions & 13 deletions common/src/main/java/net/mca/entity/VillagerEntityMCA.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ public class VillagerEntityMCA extends VillagerEntity implements VillagerLike<Vi
private int burned;
private long lastHit = 0;
private int prevGrowthAmount;
private boolean recalcDimensionsBlocked;
private boolean interactedWith;

private static final int recalculateDimensionsEveryNTicks = 100;

public static <E extends Entity> CDataManager.Builder<E> createTrackedData(Class<E> type) {
return VillagerLike.createTrackedData(type).addAll(INFECTION_PROGRESS, GROWTH_AMOUNT)
.add(Residency::createTrackedData)
Expand Down Expand Up @@ -757,7 +758,7 @@ public void tick() {

// update visual age
int age = getTrackedValue(GROWTH_AMOUNT);
if (age != prevGrowthAmount || recalcDimensionsBlocked) {
if (age / recalculateDimensionsEveryNTicks != prevGrowthAmount / recalculateDimensionsEveryNTicks) {
prevGrowthAmount = age;
calculateDimensions();
}
Expand Down Expand Up @@ -824,8 +825,6 @@ public void calculateDimensions() {
AgeState current = getAgeState();
AgeState next = current.getNext();

VillagerDimensions.Mutable old = new VillagerDimensions.Mutable(dimensions);

// either interpolate or set if final age is reached
if (next != current) {
dimensions.interpolate(current, next, AgeState.getDelta(getTrackedValue(GROWTH_AMOUNT)));
Expand All @@ -839,15 +838,6 @@ public void calculateDimensions() {
boolean oldOnGround = this.onGround;
super.calculateDimensions();
this.onGround = oldOnGround;

// prevents from growing into the wall
if (!this.firstUpdate && !world.isSpaceEmpty(this)) {
dimensions.set(old);
super.calculateDimensions();
recalcDimensionsBlocked = true;
} else {
recalcDimensionsBlocked = false;
}
}

@Override
Expand Down
Loading

0 comments on commit bf98402

Please sign in to comment.