Skip to content

Commit 50b91d3

Browse files
committed
[version patch] 1.14.4
1 parent 5567284 commit 50b91d3

File tree

7 files changed

+27
-44
lines changed

7 files changed

+27
-44
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Current available options are:
1313

1414
V1.0.0-rc2:
1515
- Full French (France) translation
16+
1617
V1.0.0-rc1:
1718
- Initial release
1819
- 1.16.3 and 1.15.2 support

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/use
6-
minecraft_version=1.15.2
7-
yarn_mappings=1.15.2+build.17
6+
minecraft_version=1.14.4
7+
yarn_mappings=1.14.4+build.18
88
loader_version=0.10.0+build.208
99

1010
# Mod Properties
@@ -14,4 +14,4 @@ org.gradle.jvmargs=-Xmx1G
1414

1515
# Dependencies
1616
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
17-
fabric_version=0.23.0+build.328-1.15
17+
fabric_version=0.23.0+build.264-1.14

src/main/java/org/scbrm/fidelity/WhipItem.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import java.util.Random;
1919

2020
public class WhipItem extends Item {
21-
private static final Random random = new Random();
22-
2321
public WhipItem(Settings settings) {
2422
super(settings);
2523
}
@@ -49,22 +47,10 @@ public boolean useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity enti
4947
iequine.setMasterUuid(null);
5048
user.sendMessage(new TranslatableText("fidelity.text.setstate." + state.toString()));
5149
} else if(equine.isAlive() && !equine.isTame() && user.world.isClient) {
52-
spawnParticles(entity, false);
50+
((IHorseBaseEntity)equine).spawnPlayerReactionParticles( false);
5351
}
5452
}
5553
return true;
5654
}
5755

58-
private void spawnParticles(LivingEntity entity, boolean positive) {
59-
ParticleEffect particleEffect = positive ? ParticleTypes.HEART : ParticleTypes.SMOKE;
60-
61-
for(int i = 0; i < 7; ++i) {
62-
double d = random.nextGaussian() * 0.02D;
63-
double e = random.nextGaussian() * 0.02D;
64-
double f = random.nextGaussian() * 0.02D;
65-
entity.world.addParticle(particleEffect, entity.getParticleX(1.0D), entity.getRandomBodyY() + 0.5D, entity.getParticleZ(1.0D), d, e, f);
66-
}
67-
68-
}
69-
7056
}

src/main/java/org/scbrm/fidelity/bridge/IHorseBaseEntity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,6 @@ default boolean isMaster(LivingEntity entity) {
4747
@NotNull
4848
State getState();
4949
void setState(@NotNull State state);
50+
51+
void spawnPlayerReactionParticles(boolean positive);
5052
}

src/main/java/org/scbrm/fidelity/entity/ai/goal/ObeyMasterGoal.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.scbrm.fidelity.entity.ai.goal;
22

3+
import net.minecraft.block.BlockState;
34
import org.scbrm.fidelity.bridge.IHorseBaseEntity;
45
import net.minecraft.entity.LivingEntity;
56
import net.minecraft.entity.ai.goal.Goal;
@@ -8,14 +9,14 @@
89
import net.minecraft.entity.ai.pathing.PathNodeType;
910
import net.minecraft.entity.passive.HorseBaseEntity;
1011
import net.minecraft.util.math.BlockPos;
11-
import net.minecraft.world.WorldView;
12+
import net.minecraft.world.CollisionView;
1213

1314
import java.util.Optional;
1415

1516
public class ObeyMasterGoal extends Goal {
1617
private final HorseBaseEntity equine;
1718
private LivingEntity master;
18-
private final WorldView world;
19+
private final CollisionView world;
1920
private final double speed;
2021
private final EntityNavigation navigation;
2122
private int updateCountdownTicks;
@@ -97,25 +98,20 @@ private void tryTeleport() {
9798
}
9899

99100
private boolean tryTeleportTo(int x, int y, int z) {
100-
if (Math.abs((double)x - this.master.getX()) < 2.0D && Math.abs((double)z - this.master.getZ()) < 2.0D) {
101+
if (Math.abs((double)x - this.master.x) < 2.0D && Math.abs((double)z - this.master.z) < 2.0D) {
101102
return false;
102103
} else if (!this.canTeleportTo(new BlockPos(x, y, z))) {
103104
return false;
104105
} else {
105-
this.equine.refreshPositionAndAngles((double)((float)x + 0.5F), (double)y, (double)((float)z + 0.5F), this.equine.yaw, this.equine.pitch);
106+
this.equine.refreshPositionAndAngles((double)((float)x + 0.5F), (double)y + 1, (double)((float)z + 0.5F), this.equine.yaw, this.equine.pitch);
106107
this.navigation.stop();
107108
return true;
108109
}
109110
}
110111

111112
private boolean canTeleportTo(BlockPos pos) {
112-
PathNodeType pathNodeType = LandPathNodeMaker.getPathNodeType(this.world, pos.getX(), pos.getY(), pos.getZ());
113-
if (pathNodeType != PathNodeType.WALKABLE) {
114-
return false;
115-
} else {
116-
final BlockPos blockPos = pos.subtract(new BlockPos(this.equine));
117-
return this.world.doesNotCollide(this.equine, this.equine.getBoundingBox().offset(blockPos));
118-
}
113+
final BlockState blockState = this.world.getBlockState(pos);
114+
return blockState.allowsSpawning(this.world, pos, this.equine.getType()) && this.world.isAir(pos.up()) && this.world.isAir(pos.up(2));
119115
}
120116

121117
private Optional<Boolean> isStateRelevant() {

src/main/java/org/scbrm/fidelity/mixin/HorseBaseEntityMixin.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.jetbrains.annotations.NotNull;
1818
import org.jetbrains.annotations.Nullable;
1919
import org.spongepowered.asm.mixin.Mixin;
20+
import org.spongepowered.asm.mixin.Shadow;
2021
import org.spongepowered.asm.mixin.injection.At;
2122
import org.spongepowered.asm.mixin.injection.Inject;
2223
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -30,7 +31,8 @@ public abstract class HorseBaseEntityMixin extends AnimalEntity implements IHors
3031
private static final TrackedData<Optional<UUID>> MASTER_UUID = DataTracker.registerData(HorseBaseEntity.class, TrackedDataHandlerRegistry.OPTIONAL_UUID);
3132
private State state = State.ROAMING_FREE;
3233

33-
/*@Shadow protected abstract void spawnPlayerReactionParticles(boolean positive);*/
34+
@Shadow
35+
public abstract void spawnPlayerReactionParticles(boolean positive);
3436

3537
protected HorseBaseEntityMixin(EntityType<? extends HorseBaseEntity> entityType, World world) {
3638
super(entityType, world);
@@ -77,26 +79,22 @@ public void setState(@NotNull State state) {
7779
@Inject(at = @At("TAIL"), method = "writeCustomDataToTag(Lnet/minecraft/nbt/CompoundTag;)V")
7880
public void _writeCustomDataToTag(CompoundTag tag, CallbackInfo info) {
7981
if (this.getMasterUuid() != null) {
80-
tag.putUuid("Master", this.getMasterUuid());
82+
tag.putString("MasterUUID", this.getMasterUuid().toString());
8183
}
8284

8385
tag.putByte("FidelityState", (byte)this.state.ordinal());
8486
}
8587

8688
@Inject(at = @At("TAIL"), method = "readCustomDataFromTag(Lnet/minecraft/nbt/CompoundTag;)V")
8789
public void _readCustomDataFromTag(CompoundTag tag, CallbackInfo info) {
88-
final UUID uuid = tag.containsUuid("Master") ?
89-
tag.getUuid("Master") :
90-
UUID.fromString(ServerConfigHandler.getPlayerUuidByName(this.getServer(), tag.getString("Master")));
91-
92-
if (uuid != null) {
93-
try {
94-
this.setMasterUuid(uuid);
95-
this.state = State.values()[tag.getByte("FidelityState")];
96-
} catch (Throwable e) {
97-
this.state = State.ROAMING_FREE;
98-
}
99-
}
90+
final String uuidStr = tag.contains("MasterUUID", 8) ?
91+
tag.getString("MasterUUID") :
92+
ServerConfigHandler.getPlayerUuidByName(this.getServer(), tag.getString("Master"));
93+
94+
if (!uuidStr.isEmpty())
95+
this.setMasterUuid(UUID.fromString(uuidStr));
96+
97+
this.state = tag.contains("FidelityState") ? State.values()[tag.getByte("FidelityState")] : State.ROAMING_FREE;
10098
}
10199

102100
@Inject(at = @At("HEAD"), method = "putPlayerOnBack(Lnet/minecraft/entity/player/PlayerEntity;)V", cancellable = true)

src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"depends": {
3030
"fabricloader": ">=0.7.4",
3131
"fabric": "*",
32-
"minecraft": "1.15.x"
32+
"minecraft": "1.14.x"
3333
},
3434
"suggests": {
3535
"flamingo": "*"

0 commit comments

Comments
 (0)