Skip to content

Commit

Permalink
Merge branch 'dev/update_2.0' into feat/new-trims
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDeathlyCow committed Jan 2, 2025
2 parents 2dc2daf + 0004622 commit 3e653a4
Show file tree
Hide file tree
Showing 41 changed files with 488 additions and 584 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mod_menu_version=11.0.3
cloth_config_version=15.0.140

# Thermoo
thermoo_version=4.2.3
thermoo_version=4.2.5

# Colorful Hearts (10.3.8)
colorful_hearts_version=r2mnc8w2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.github.thedeathlycow.frostiful.client.gui;

import com.github.thedeathlycow.frostiful.Frostiful;
import com.github.thedeathlycow.frostiful.config.FrostifulConfig;
import com.github.thedeathlycow.frostiful.entity.RootedEntity;
import com.github.thedeathlycow.frostiful.entity.component.FrostWandRootComponent;
import com.github.thedeathlycow.frostiful.registry.FComponents;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Identifier;

public class RootedOverlayRenderer {
Expand All @@ -13,19 +13,18 @@ public class RootedOverlayRenderer {
private static final Identifier FROSTIFUL_ROOTED_OVERLAY = Identifier.ofVanilla("textures/block/ice.png");

public static void render(
RootedEntity rooted,
LivingEntity entity,
DrawContext context,
RenderTickCounter tickCounter,
OverlayRenderCallback callback
) {
if (rooted.frostiful$isRooted()) {
FrostifulConfig config = Frostiful.getConfig();
float opacity = ((float) rooted.frostiful$getRootedTicks()) / config.combatConfig.getFrostWandRootTime();
callback.renderOverlay(context, FROSTIFUL_ROOTED_OVERLAY, opacity);
FrostWandRootComponent component = FComponents.FROST_WAND_ROOT_COMPONENT.get(entity);
if (component.isRooted()) {
callback.renderOverlay(context, FROSTIFUL_ROOTED_OVERLAY, component.getRootProgress());
}
}

private RootedOverlayRenderer() {
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.thedeathlycow.frostiful.client.mixin.entity_renderer;

import com.github.thedeathlycow.frostiful.entity.RootedEntity;
import com.github.thedeathlycow.frostiful.registry.FComponents;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
Expand Down Expand Up @@ -45,15 +45,15 @@ private void initAddon(EntityRendererFactory.Context ctx, M model, float shadowR
)
)
private void renderIceOnEntity(T livingEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) {
if (livingEntity instanceof RootedEntity rootedEntity && rootedEntity.frostiful$isRooted()) {
if (FComponents.FROST_WAND_ROOT_COMPONENT.get(livingEntity).isRooted()) {
matrixStack.push();
float blockSize = 1.75f;
Box boundingBox = livingEntity.getBoundingBox();
BlockPos blockPos = BlockPos.ofFloored(livingEntity.getX(), boundingBox.minY, livingEntity.getZ());
matrixStack.scale(
blockSize * (float)boundingBox.getLengthX(),
blockSize * (float)boundingBox.getLengthY(),
blockSize * (float)boundingBox.getLengthZ()
blockSize * (float) boundingBox.getLengthX(),
blockSize * (float) boundingBox.getLengthY(),
blockSize * (float) boundingBox.getLengthZ()
);
matrixStack.translate(-0.5, -0.3, -0.5);
this.frostiful$renderBlock(livingEntity, matrixStack, vertexConsumerProvider, blockPos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.github.thedeathlycow.frostiful.client.gui.FrostOverlayRenderer;
import com.github.thedeathlycow.frostiful.client.gui.RootedOverlayRenderer;
import com.github.thedeathlycow.frostiful.entity.RootedEntity;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
Expand Down Expand Up @@ -57,7 +56,7 @@ private boolean blockVanillaFrozenOverlayRender(
private void renderRootedOverlay(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) {
if (this.client.player != null) {
RootedOverlayRenderer.render(
(RootedEntity) this.client.player,
this.client.player,
context, tickCounter,
this::renderOverlay
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.thedeathlycow.frostiful.client.model;

import com.github.thedeathlycow.frostiful.entity.FrostologerEntity;
import com.github.thedeathlycow.frostiful.entity.frostologer.FrostologerEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.github.thedeathlycow.frostiful.client.render.feature.FrostologerCloakFeatureRenderer;
import com.github.thedeathlycow.frostiful.client.render.feature.FrostologerEyesFeatureRenderer;
import com.github.thedeathlycow.frostiful.client.render.feature.FrostologerFrostFeatureRenderer;
import com.github.thedeathlycow.frostiful.entity.FrostologerEntity;
import com.github.thedeathlycow.frostiful.entity.frostologer.FrostologerEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRendererFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.thedeathlycow.frostiful.client.render.feature;

import com.github.thedeathlycow.frostiful.Frostiful;
import com.github.thedeathlycow.frostiful.entity.FrostologerEntity;
import com.github.thedeathlycow.frostiful.entity.frostologer.FrostologerEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.util.Identifier;
Expand All @@ -13,8 +13,8 @@
public enum FrostLayers {

NONE(0.0f, null),
LOW(-0.5f, Frostiful.id("textures/entity/illager/frostologer/low_frost.png")),
MEDIUM(-0.75f, Frostiful.id("textures/entity/illager/frostologer/medium_frost.png")),
LOW(-0.25f, Frostiful.id("textures/entity/illager/frostologer/low_frost.png")),
MEDIUM(-0.5f, Frostiful.id("textures/entity/illager/frostologer/medium_frost.png")),
HIGH(FrostologerEntity.MAX_POWER_SCALE_START, Frostiful.id("textures/entity/illager/frostologer/high_frost.png"));

public static final FrostLayers[] LAYERS_WITHOUT_NONE = Stream.of(FrostLayers.values())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.thedeathlycow.frostiful.client.render.feature;

import com.github.thedeathlycow.frostiful.client.model.FrostologerEntityModel;
import com.github.thedeathlycow.frostiful.entity.FrostologerEntity;
import com.github.thedeathlycow.frostiful.entity.frostologer.FrostologerEntity;
import com.github.thedeathlycow.frostiful.item.cloak.AbstractFrostologyCloakItem;
import com.github.thedeathlycow.frostiful.registry.FItems;
import net.fabricmc.api.EnvType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.thedeathlycow.frostiful.client.render.feature;

import com.github.thedeathlycow.frostiful.client.model.FrostologerEntityModel;
import com.github.thedeathlycow.frostiful.entity.FrostologerEntity;
import com.github.thedeathlycow.frostiful.entity.frostologer.FrostologerEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.OverlayTexture;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.thedeathlycow.frostiful.client.render.feature;

import com.github.thedeathlycow.frostiful.client.model.FrostologerEntityModel;
import com.github.thedeathlycow.frostiful.entity.FrostologerEntity;
import com.github.thedeathlycow.frostiful.entity.frostologer.FrostologerEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.VertexConsumerProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.thedeathlycow.frostiful.compat.FrostifulIntegrations;
import com.github.thedeathlycow.frostiful.config.FrostifulConfig;
import com.github.thedeathlycow.frostiful.entity.component.FrostWandRootComponent;
import com.github.thedeathlycow.frostiful.entity.loot.StrayLootTableModifier;
import com.github.thedeathlycow.frostiful.item.FrostedBanner;
import com.github.thedeathlycow.frostiful.item.cloak.AbstractFrostologyCloakItem;
Expand All @@ -19,6 +20,7 @@
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;
import net.fabricmc.fabric.api.loot.v3.LootTableEvents;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import net.fabricmc.fabric.api.util.TriState;
Expand Down Expand Up @@ -79,6 +81,8 @@ public void onInitialize() {
FFeatures.initialize();
FPlacedFeatures.initialize();

ServerLivingEntityEvents.AFTER_DAMAGE.register(FrostWandRootComponent::afterDamage);

this.registerThermooEventListeners();
PayloadTypeRegistry.playS2C().register(
PointWindSpawnPacket.PACKET_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,18 @@ public class CombatConfigGroup implements ConfigData {

int frostologerHeatDrainPerTick = 30;

int frostologerCoolingFromFrostWandHit = 6300 / 6;

int packedSnowballFreezeAmount = 500;

float packedSnowballDamage = 2.0f;

float packedSnowballVulnerableTypesDamage = 5.0f;

int frostologerPassiveFreezingPerTick = 2;

float frostologerMaxPassiveFreezing = 0.5f;

int biterFrostBiteMaxAmplifier = 2;

float chillagerFireDamageMultiplier = 1.5f;

int frostologerIntolerableHeat = 9;

@ConfigEntry.Gui.RequiresRestart
float skateUpgradeTemplateIglooGenerateChance = 0.75f;

Expand Down Expand Up @@ -73,6 +69,10 @@ public int getFrostologerHeatDrainPerTick() {
return 2 * frostologerHeatDrainPerTick;
}

public int getFrostologerCoolingFromFrostWandHit() {
return frostologerCoolingFromFrostWandHit;
}

public int getPackedSnowballFreezeAmount() {
return packedSnowballFreezeAmount;
}
Expand All @@ -85,14 +85,6 @@ public float getPackedSnowballVulnerableTypesDamage() {
return packedSnowballVulnerableTypesDamage;
}

public int getFrostologerPassiveFreezingPerTick() {
return frostologerPassiveFreezingPerTick;
}

public float getFrostologerMaxPassiveFreezing() {
return frostologerMaxPassiveFreezing;
}

public int getBiterFrostBiteMaxAmplifier() {
return Math.max(0, this.biterFrostBiteMaxAmplifier);
}
Expand All @@ -101,10 +93,6 @@ public float getChillagerFireDamageMultiplier() {
return chillagerFireDamageMultiplier;
}

public int getFrostologerIntolerableHeat() {
return frostologerIntolerableHeat;
}

public float getSkateUpgradeTemplateIglooGenerateChance() {
return MathHelper.clamp(skateUpgradeTemplateIglooGenerateChance, 0f, 1f);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.thedeathlycow.frostiful.entity;

import com.github.thedeathlycow.frostiful.Frostiful;
import com.github.thedeathlycow.frostiful.registry.FComponents;
import com.github.thedeathlycow.frostiful.registry.FSoundEvents;
import com.github.thedeathlycow.frostiful.registry.FStatusEffects;
import com.github.thedeathlycow.thermoo.api.ThermooAttributes;
Expand Down Expand Up @@ -64,16 +65,21 @@ public void tickMovement() {
}
}

@Override
public boolean tryAttack(Entity target) {
this.attackTicks = ATTACK_TIME;
this.getWorld().sendEntityStatus(this, EntityStatuses.PLAY_ATTACK_SOUND);
this.playAttackSound();
if (target instanceof LivingEntity livingTarget && ((RootedEntity) livingTarget).frostiful$isRooted()) {

if (target instanceof LivingEntity livingTarget && FComponents.FROST_WAND_ROOT_COMPONENT.get(livingTarget).isRooted()) {
int maxAmplifier = Frostiful.getConfig().combatConfig.getBiterFrostBiteMaxAmplifier() + 1;

livingTarget.addStatusEffect(
new StatusEffectInstance(FStatusEffects.FROST_BITE, 20 * 15, this.random.nextInt(maxAmplifier)), this
new StatusEffectInstance(
FStatusEffects.FROST_BITE,
20 * 15,
this.random.nextInt(maxAmplifier)
),
this
);
}
return super.tryAttack(target);
Expand All @@ -82,7 +88,7 @@ public boolean tryAttack(Entity target) {
@Override
protected void initDataTracker(DataTracker.Builder builder) {
super.initDataTracker(builder);
builder.add(ICE_GOLEM_FLAGS, (byte)0);
builder.add(ICE_GOLEM_FLAGS, (byte) 0);
}

protected void initGoals() {
Expand Down Expand Up @@ -169,7 +175,7 @@ private void setIceGolemFlag(int mask, boolean value) {
flags &= ~mask;
}

this.dataTracker.set(ICE_GOLEM_FLAGS, (byte)(flags & 0xff));
this.dataTracker.set(ICE_GOLEM_FLAGS, (byte) (flags & 0xff));
}

public void playAttackSound() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.thedeathlycow.frostiful.Frostiful;
import com.github.thedeathlycow.frostiful.config.FrostifulConfig;
import com.github.thedeathlycow.frostiful.entity.frostologer.FrostologerEntity;
import com.github.thedeathlycow.frostiful.registry.FEntityTypes;
import com.github.thedeathlycow.frostiful.registry.FItems;
import com.github.thedeathlycow.frostiful.registry.FSoundEvents;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.thedeathlycow.frostiful.entity;

import com.github.thedeathlycow.frostiful.registry.FComponents;
import com.github.thedeathlycow.frostiful.registry.FEntityTypes;
import com.github.thedeathlycow.frostiful.registry.FSoundEvents;
import net.minecraft.entity.Entity;
Expand Down Expand Up @@ -70,8 +71,8 @@ protected void applyEffectCloud() {
@Override
protected void applySingleTargetEffect(Entity target) {
World world = target.getWorld();
if (!world.isClient && target instanceof RootedEntity rootedEntity) {
if (rootedEntity.frostiful$root(this.getOwner())) {
if (!world.isClient) {
if (FComponents.FROST_WAND_ROOT_COMPONENT.get(target).tryRootFromFrostWand(this.getOwner())) {
world.playSound(
null,
target.getX(), target.getY(), target.getZ(),
Expand Down
Loading

0 comments on commit 3e653a4

Please sign in to comment.