Skip to content

Commit

Permalink
Merge branch '1.19.3' into 1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Treetrain1 committed Jun 28, 2023
2 parents 138bcff + a525085 commit 4cabab1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 45 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Make sure to clear this after each release

Put changelog here:
-----------------
- Allowed malformed properties in ItemBlockStateTagUtils.getProperty()
- Fixed mob spawners not running `finalizeSpawn()` when spawning mobs
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
loader_version=0.14.19

# Mod Properties
mod_version = 1.2.5
mod_version = 1.2.6
mod_loader = Fabric
maven_group = net.frozenblock
archives_base_name = FrozenLib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void tick() {
this.ticksToCheck = 20;
if (this.icon != null) {
if (this.entity.level.isClientSide) {
this.clientHasIconResource = ClientSpottingIconMethods.hasTexture(this.icon.getTexture());
this.clientHasIconResource = ClientSpottingIconMethods.hasTexture(this.icon.texture());
}
if (!SpottingIconPredicate.getPredicate(this.icon.restrictionID).test(this.entity)) {
this.removeIcon();
Expand All @@ -76,7 +76,7 @@ public void setIcon(ResourceLocation texture, float startFade, float endFade, Re
ServerPlayNetworking.send(player, FrozenMain.SPOTTING_ICON_PACKET, byteBuf);
}
} else {
this.clientHasIconResource = ClientSpottingIconMethods.hasTexture(this.icon.getTexture());
this.clientHasIconResource = ClientSpottingIconMethods.hasTexture(this.icon.texture());
}
SpottingIconPredicate.getPredicate(this.icon.restrictionID).onAdded(this.entity);
}
Expand Down Expand Up @@ -106,7 +106,7 @@ public void sendIconPacket(ServerPlayer player) {
}

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

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

public static class SpottingIcon {
public final ResourceLocation texture;
public final float startFadeDist;
public final float endFadeDist;
public final ResourceLocation restrictionID;

public static final Codec<SpottingIcon> CODEC = RecordCodecBuilder.create((instance) -> instance.group(
ResourceLocation.CODEC.fieldOf("texture").forGetter(SpottingIcon::getTexture),
Codec.FLOAT.fieldOf("startFadeDist").forGetter(SpottingIcon::getStartFadeDist),
Codec.FLOAT.fieldOf("endFadeDist").forGetter(SpottingIcon::getEndFadeDist),
ResourceLocation.CODEC.fieldOf("restrictionID").forGetter(SpottingIcon::getRestrictionID)
).apply(instance, SpottingIcon::new));

public SpottingIcon(ResourceLocation texture, float startFadeDist, float endFadeDist, ResourceLocation restrictionID) {
this.texture = texture;
this.startFadeDist = startFadeDist;
this.endFadeDist = endFadeDist;
this.restrictionID = restrictionID;
}

public ResourceLocation getTexture() {
return this.texture;
}

public float getStartFadeDist() {
return this.startFadeDist;
}

public float getEndFadeDist() {
return this.endFadeDist;
}

public ResourceLocation getRestrictionID() {
return this.restrictionID;
}
public record SpottingIcon(ResourceLocation texture, float startFadeDist, float endFadeDist, ResourceLocation restrictionID) {
public static final Codec<SpottingIcon> CODEC = RecordCodecBuilder.create((instance) -> instance.group(
ResourceLocation.CODEC.fieldOf("texture").forGetter(SpottingIcon::texture),
Codec.FLOAT.fieldOf("startFadeDist").forGetter(SpottingIcon::startFadeDist),
Codec.FLOAT.fieldOf("endFadeDist").forGetter(SpottingIcon::endFadeDist),
ResourceLocation.CODEC.fieldOf("restrictionID").forGetter(SpottingIcon::restrictionID)
).apply(instance, SpottingIcon::new));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public <T extends Entity> void renderIcon(T entity, float entityYaw, float parti
SpottingIconManager.SpottingIcon icon = iconManager.icon;
if (icon != null) {
double dist = Mth.sqrt((float) this.entityRenderDispatcher.distanceToSqr(entity));
if (dist > icon.startFadeDist && iconManager.clientHasIconResource) {
float endDist = icon.endFadeDist - icon.startFadeDist;
dist -= icon.startFadeDist;
if (dist > icon.startFadeDist() && iconManager.clientHasIconResource) {
float endDist = icon.endFadeDist() - icon.startFadeDist();
dist -= icon.startFadeDist();
float alpha = dist > endDist ? 1F : (float) Math.min(1F, dist / endDist);
float f = entity.getBbHeight() + 1F;
matrixStack.pushPose();
Expand All @@ -63,7 +63,7 @@ public <T extends Entity> void renderIcon(T entity, float entityYaw, float parti
Matrix4f matrix4f = matrixStack.last().pose();
Matrix3f matrix3f = matrixStack.last().normal();
int overlay = OverlayTexture.pack(OverlayTexture.u(0F), OverlayTexture.v(false));
VertexConsumer vertexConsumer = buffer.getBuffer(FrozenRenderType.entityTranslucentEmissiveAlwaysRender(((EntitySpottingIconInterface) entity).getSpottingIconManager().icon.getTexture()));
VertexConsumer vertexConsumer = buffer.getBuffer(FrozenRenderType.entityTranslucentEmissiveAlwaysRender(((EntitySpottingIconInterface) entity).getSpottingIconManager().icon.texture()));
vertexConsumer
.vertex(matrix4f, -0.5F, -0.5F, 0.0F)
.color(1, 1, 1, alpha)
Expand Down

0 comments on commit 4cabab1

Please sign in to comment.