Skip to content

Commit 4cabab1

Browse files
committed
Merge branch '1.19.3' into 1.19.4
2 parents 138bcff + a525085 commit 4cabab1

File tree

4 files changed

+17
-45
lines changed

4 files changed

+17
-45
lines changed

CHANGELOG.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Make sure to clear this after each release
44

55
Put changelog here:
66
-----------------
7-
- Allowed malformed properties in ItemBlockStateTagUtils.getProperty()
7+
- Fixed mob spawners not running `finalizeSpawn()` when spawning mobs

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
loader_version=0.14.19
1717

1818
# Mod Properties
19-
mod_version = 1.2.5
19+
mod_version = 1.2.6
2020
mod_loader = Fabric
2121
maven_group = net.frozenblock
2222
archives_base_name = FrozenLib

src/main/java/net/frozenblock/lib/spotting_icons/api/SpottingIconManager.java

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void tick() {
5454
this.ticksToCheck = 20;
5555
if (this.icon != null) {
5656
if (this.entity.level.isClientSide) {
57-
this.clientHasIconResource = ClientSpottingIconMethods.hasTexture(this.icon.getTexture());
57+
this.clientHasIconResource = ClientSpottingIconMethods.hasTexture(this.icon.texture());
5858
}
5959
if (!SpottingIconPredicate.getPredicate(this.icon.restrictionID).test(this.entity)) {
6060
this.removeIcon();
@@ -76,7 +76,7 @@ public void setIcon(ResourceLocation texture, float startFade, float endFade, Re
7676
ServerPlayNetworking.send(player, FrozenMain.SPOTTING_ICON_PACKET, byteBuf);
7777
}
7878
} else {
79-
this.clientHasIconResource = ClientSpottingIconMethods.hasTexture(this.icon.getTexture());
79+
this.clientHasIconResource = ClientSpottingIconMethods.hasTexture(this.icon.texture());
8080
}
8181
SpottingIconPredicate.getPredicate(this.icon.restrictionID).onAdded(this.entity);
8282
}
@@ -106,7 +106,7 @@ public void sendIconPacket(ServerPlayer player) {
106106
}
107107

108108
public void load(CompoundTag nbt) {
109-
nbt.putInt("frozenSpottingIconTicksToCheck", this.ticksToCheck);
109+
this.ticksToCheck = nbt.getInt("frozenSpottingIconTicksToCheck");
110110
if (nbt.contains("frozenSpottingIcons")) {
111111
this.icon = null;
112112
DataResult<SpottingIcon> var10000 = SpottingIcon.CODEC.parse(new Dynamic<>(NbtOps.INSTANCE, nbt.getCompound("frozenSpottingIcons")));
@@ -118,7 +118,7 @@ public void load(CompoundTag nbt) {
118118
}
119119

120120
public void save(CompoundTag nbt) {
121-
this.ticksToCheck = nbt.getInt("frozenSpottingIconTicksToCheck");
121+
nbt.putInt("frozenSpottingIconTicksToCheck", this.ticksToCheck);
122122
if (this.icon != null) {
123123
DataResult<Tag> var10000 = SpottingIcon.CODEC.encodeStart(NbtOps.INSTANCE, this.icon);
124124
Logger var10001 = FrozenMain.LOGGER4;
@@ -129,40 +129,12 @@ public void save(CompoundTag nbt) {
129129
}
130130
}
131131

132-
public static class SpottingIcon {
133-
public final ResourceLocation texture;
134-
public final float startFadeDist;
135-
public final float endFadeDist;
136-
public final ResourceLocation restrictionID;
137-
138-
public static final Codec<SpottingIcon> CODEC = RecordCodecBuilder.create((instance) -> instance.group(
139-
ResourceLocation.CODEC.fieldOf("texture").forGetter(SpottingIcon::getTexture),
140-
Codec.FLOAT.fieldOf("startFadeDist").forGetter(SpottingIcon::getStartFadeDist),
141-
Codec.FLOAT.fieldOf("endFadeDist").forGetter(SpottingIcon::getEndFadeDist),
142-
ResourceLocation.CODEC.fieldOf("restrictionID").forGetter(SpottingIcon::getRestrictionID)
143-
).apply(instance, SpottingIcon::new));
144-
145-
public SpottingIcon(ResourceLocation texture, float startFadeDist, float endFadeDist, ResourceLocation restrictionID) {
146-
this.texture = texture;
147-
this.startFadeDist = startFadeDist;
148-
this.endFadeDist = endFadeDist;
149-
this.restrictionID = restrictionID;
150-
}
151-
152-
public ResourceLocation getTexture() {
153-
return this.texture;
154-
}
155-
156-
public float getStartFadeDist() {
157-
return this.startFadeDist;
158-
}
159-
160-
public float getEndFadeDist() {
161-
return this.endFadeDist;
162-
}
163-
164-
public ResourceLocation getRestrictionID() {
165-
return this.restrictionID;
166-
}
132+
public record SpottingIcon(ResourceLocation texture, float startFadeDist, float endFadeDist, ResourceLocation restrictionID) {
133+
public static final Codec<SpottingIcon> CODEC = RecordCodecBuilder.create((instance) -> instance.group(
134+
ResourceLocation.CODEC.fieldOf("texture").forGetter(SpottingIcon::texture),
135+
Codec.FLOAT.fieldOf("startFadeDist").forGetter(SpottingIcon::startFadeDist),
136+
Codec.FLOAT.fieldOf("endFadeDist").forGetter(SpottingIcon::endFadeDist),
137+
ResourceLocation.CODEC.fieldOf("restrictionID").forGetter(SpottingIcon::restrictionID)
138+
).apply(instance, SpottingIcon::new));
167139
}
168140
}

src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/EntityRendererMixin.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public <T extends Entity> void renderIcon(T entity, float entityYaw, float parti
5151
SpottingIconManager.SpottingIcon icon = iconManager.icon;
5252
if (icon != null) {
5353
double dist = Mth.sqrt((float) this.entityRenderDispatcher.distanceToSqr(entity));
54-
if (dist > icon.startFadeDist && iconManager.clientHasIconResource) {
55-
float endDist = icon.endFadeDist - icon.startFadeDist;
56-
dist -= icon.startFadeDist;
54+
if (dist > icon.startFadeDist() && iconManager.clientHasIconResource) {
55+
float endDist = icon.endFadeDist() - icon.startFadeDist();
56+
dist -= icon.startFadeDist();
5757
float alpha = dist > endDist ? 1F : (float) Math.min(1F, dist / endDist);
5858
float f = entity.getBbHeight() + 1F;
5959
matrixStack.pushPose();
@@ -63,7 +63,7 @@ public <T extends Entity> void renderIcon(T entity, float entityYaw, float parti
6363
Matrix4f matrix4f = matrixStack.last().pose();
6464
Matrix3f matrix3f = matrixStack.last().normal();
6565
int overlay = OverlayTexture.pack(OverlayTexture.u(0F), OverlayTexture.v(false));
66-
VertexConsumer vertexConsumer = buffer.getBuffer(FrozenRenderType.entityTranslucentEmissiveAlwaysRender(((EntitySpottingIconInterface) entity).getSpottingIconManager().icon.getTexture()));
66+
VertexConsumer vertexConsumer = buffer.getBuffer(FrozenRenderType.entityTranslucentEmissiveAlwaysRender(((EntitySpottingIconInterface) entity).getSpottingIconManager().icon.texture()));
6767
vertexConsumer
6868
.vertex(matrix4f, -0.5F, -0.5F, 0.0F)
6969
.color(1, 1, 1, alpha)

0 commit comments

Comments
 (0)