Skip to content

Commit

Permalink
同步更新 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
TartaricAcid committed Oct 8, 2023
1 parent 956f05c commit 42873e7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ dependencies {
implementation fg.deobf("teamtwilight:twilightforest:${twilight_forest_version}:universal")
}

jar {
manifest {
attributes([
"Implementation-Title" : project.name,
"Implementation-Version": "${version}"
])
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
org.gradle.jvmargs=-Xmx4G
org.gradle.daemon=false
mod_version=1.1.1
mod_version=1.1.2
forge_version=1.19.2-43.2.0
mc_version=1.19.2
jei_version=11.4.0.286
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ public MaidMoveToBlockTask(float movementSpeed, int searchRange, int verticalSea

protected final void searchForDestination(ServerLevel worldIn, EntityMaid maid) {
BlockPos blockpos = maid.blockPosition();
BlockPos.MutableBlockPos blockPos = new BlockPos.MutableBlockPos();
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
for (int y = this.verticalSearchStart; y <= this.verticalSearchRange; y = y > 0 ? -y : 1 - y) {
for (int i = 0; i < this.searchRange; ++i) {
for (int x = 0; x <= i; x = x > 0 ? -x : 1 - x) {
for (int z = x < i && x > -i ? i : 0; z <= i; z = z > 0 ? -z : 1 - z) {
blockPos.setWithOffset(blockpos, x, y - 1, z);
if (maid.isWithinRestriction(blockPos) && shouldMoveTo(worldIn, maid, blockPos) && checkPathReach(maid, blockPos)) {
BehaviorUtils.setWalkAndLookTargetMemories(maid, blockPos, this.movementSpeed, 0);
maid.getBrain().setMemory(InitEntities.TARGET_POS.get(), new BlockPosTracker(blockPos));
mutableBlockPos.setWithOffset(blockpos, x, y - 1, z);
if (maid.isWithinRestriction(mutableBlockPos) && shouldMoveTo(worldIn, maid, mutableBlockPos) && checkPathReach(maid, mutableBlockPos)
&& checkOwnerPos(maid, mutableBlockPos)) {
BehaviorUtils.setWalkAndLookTargetMemories(maid, mutableBlockPos, this.movementSpeed, 0);
maid.getBrain().setMemory(InitEntities.TARGET_POS.get(), new BlockPosTracker(mutableBlockPos));
this.setNextCheckTickCount(5);
return;
}
Expand All @@ -50,6 +51,13 @@ protected final void searchForDestination(ServerLevel worldIn, EntityMaid maid)
}
}

private boolean checkOwnerPos(EntityMaid maid, BlockPos mutableBlockPos) {
if (maid.isHomeModeEnable()) {
return true;
}
return maid.getOwner() != null && mutableBlockPos.closerToCenterThan(maid.getOwner().position(), 8);
}

/**
* 判定条件
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ private static void setMaidNameTag(SendNameTagMessage message, ServerPlayer play
maid.setCustomName(Component.literal(name));
maid.setCustomNameVisible(message.alwaysShow);
maid.setPersistenceRequired();
player.getMainHandItem().shrink(1);
if (!player.isCreative()) {
player.getMainHandItem().shrink(1);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public TileEntityMaidBeacon(BlockPos blockPos, BlockState blockState) {
}

public static void serverTick(Level level, BlockPos pos, BlockState state, TileEntityMaidBeacon beacon) {
if (beacon.level != null && !level.isClientSide && level.dayTime() % 80L == 0L) {
if (beacon.level != null && !level.isClientSide && level.getGameTime() % 80L == 0L) {
if (beacon.potionIndex != -1 && beacon.storagePower >= beacon.getEffectCost()) {
beacon.storagePower = beacon.storagePower - beacon.getEffectCost();
beacon.updateBeaconEffect(level, BeaconEffect.getEffectByIndex(beacon.potionIndex).getEffect());
Expand Down
4 changes: 1 addition & 3 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ credits = "Verclene, ZUN"
# A text field displayed in the mod UI
authors = "TartaricAcid, Snownee, Succinum, Pajinyi, ZeniCrow, Paulzzh, Yuriscat, Lappland162"
# The description text for the mod (multi line!) (#mandatory)
description = '''
A new version of the minecraft mod inspired by the LittleMaidReengaged mod.
'''
description = "A new version of the minecraft mod inspired by the LittleMaidReengaged mod."

0 comments on commit 42873e7

Please sign in to comment.