Skip to content

Commit

Permalink
finish up geckolib removal
Browse files Browse the repository at this point in the history
  • Loading branch information
Uraneptus committed Nov 10, 2024
1 parent 857f357 commit a206aa3
Show file tree
Hide file tree
Showing 22 changed files with 59 additions and 1,600 deletions.
7 changes: 0 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ minecraft {
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
jvmArg '-Dgeckolib.disable_examples=true'

mods {
sullysmod {
Expand All @@ -40,7 +39,6 @@ minecraft {
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
jvmArg '-Dgeckolib.disable_examples=true'

mods {
sullysmod {
Expand Down Expand Up @@ -80,18 +78,13 @@ repositories {
name "JEI maven"
url = "https://maven.blamejared.com/"
}
maven {
name = "GeckoLib Maven"
url = "https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/"
}
maven {
url = "https://maven.jaackson.me"
}
}

dependencies {
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
implementation fg.deobf("software.bernie.geckolib:geckolib-forge-1.20.1:${geckolib_version}")
implementation fg.deobf("com.teamabnormals:${blueprint_id}:1.20.1-${blueprint_version}")
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public class TortoiseAnimation {
))
.build();

public static final AnimationDefinition HIDE = AnimationDefinition.Builder.withLength(0.52F).looping()
public static final AnimationDefinition HIDE = AnimationDefinition.Builder.withLength(0.52F)
.addAnimation("root", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(0.0F, 1.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
Expand Down Expand Up @@ -191,7 +191,7 @@ public class TortoiseAnimation {
))
.build();

public static final AnimationDefinition REVEAL = AnimationDefinition.Builder.withLength(1.52F).looping()
public static final AnimationDefinition REVEAL = AnimationDefinition.Builder.withLength(1.52F)
.addAnimation("left_back_leg", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.24F, KeyframeAnimations.posVec(-1.0F, 1.0F, -3.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.44F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.uraneptus.sullysmod.SullysMod;
import com.uraneptus.sullysmod.client.animations.AnimUtil;
import com.uraneptus.sullysmod.client.animations.BoulderingZombieAnimation;
import com.uraneptus.sullysmod.client.animations.PiranhaAnimation;
import com.uraneptus.sullysmod.common.entities.Piranha;
import net.minecraft.client.model.EntityModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.uraneptus.sullysmod.SullysMod;
import com.uraneptus.sullysmod.client.animations.AnimUtil;
import com.uraneptus.sullysmod.client.animations.TortoiseAnimation;
import com.uraneptus.sullysmod.common.entities.Tortoise;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
Expand Down Expand Up @@ -33,6 +35,7 @@ public TortoiseModel(ModelPart pRoot) {
this.left_front_leg = body.getChild("left_front_leg");
this.shell = body.getChild("shell");
this.workstation_saddle = shell.getChild("workstation_saddle");
this.workstation_saddle.visible = false;
this.head = shell.getChild("head");
this.tail = shell.getChild("tail");
}
Expand Down Expand Up @@ -65,10 +68,18 @@ public static LayerDefinition createBodyLayer() {

@Override
public void setupAnim(E pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) {
if (!pEntity.hasAppliedWorkstation()) {
this.workstation_saddle.visible = false;
}
this.root().getAllParts().forEach(ModelPart::resetPose);
this.workstation_saddle.visible = pEntity.hasAppliedWorkstation();
this.head.xRot = pHeadPitch * ((float)Math.PI / 180F);
this.head.yRot = pNetHeadYaw * ((float)Math.PI / 180F);

//TODO do all the animations
if (pEntity.getHideTimerDuration() == 0) {
AnimUtil.animateWalk(this, TortoiseAnimation.WALK, pLimbSwing, pLimbSwingAmount, 8, 20);
}
AnimUtil.animate(this, pEntity.hideState, TortoiseAnimation.HIDE, pAgeInTicks);
AnimUtil.animate(this, pEntity.hiddenState, TortoiseAnimation.HIDING, pAgeInTicks);
AnimUtil.animate(this, pEntity.reveal_state, TortoiseAnimation.REVEAL, pAgeInTicks);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.uraneptus.sullysmod.SullysMod;
import com.uraneptus.sullysmod.client.model.BoulderingZombieModel;
import com.uraneptus.sullysmod.common.entities.BoulderingZombie;
import net.minecraft.client.model.ZombieModel;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.HumanoidMobRenderer;
import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,25 @@
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.RenderLayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FastColor;
import net.minecraft.world.effect.MobEffect;
import org.jetbrains.annotations.NotNull;
import software.bernie.geckolib.core.object.Color;

import java.awt.*;

public class JungleSpiderBeneficialPatternLayer<T extends JungleSpider, M extends JungleSpiderModel<T>> extends RenderLayer<T, M> {
private static final ResourceLocation BENEFICIAL_LAYER = SullysMod.modPrefix("textures/entity/jungle_spider/beneficial.png");

public JungleSpiderBeneficialPatternLayer(RenderLayerParent<T, M> parent) {
super(parent);
}

@Override
public void render(@NotNull PoseStack pPoseStack, @NotNull MultiBufferSource pBuffer, int pPackedLight, @NotNull T jungleSpider, float pLimbSwing, float pLimbSwingAmount, float pPartialTick, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) {
MobEffect mobEffect = jungleSpider.getBeneficialVenomEffect();
Color effectColor = Color.ofOpaque(mobEffect.getColor()).brighter(1.3F);
//Color effectColor = Color.ofOpaque(mobEffect.getColor()).brighter(1.3F);
Color color = new Color(0xFF000000 | mobEffect.getColor()).brighter();
VertexConsumer vertexConsumer = pBuffer.getBuffer(RenderType.entityTranslucent(BENEFICIAL_LAYER));
this.getParentModel().renderToBuffer(pPoseStack,vertexConsumer, pPackedLight, LivingEntityRenderer.getOverlayCoords(jungleSpider, 0.0F), effectColor.getRedFloat(), effectColor.getGreenFloat(), effectColor.getBlueFloat(), 1.0F);
this.getParentModel().renderToBuffer(pPoseStack,vertexConsumer, pPackedLight, LivingEntityRenderer.getOverlayCoords(jungleSpider, 0.0F), (float) color.getRed() / 255, (float) color.getGreen() / 255, (float) color.getBlue() / 255, 1.0F);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.effect.MobEffect;
import org.jetbrains.annotations.NotNull;
import software.bernie.geckolib.core.object.Color;

import java.awt.*;

public class JungleSpiderHarmfulPatternLayer<T extends JungleSpider, M extends JungleSpiderModel<T>> extends RenderLayer<T, M> {
private static final ResourceLocation HARMFUL_LAYER = SullysMod.modPrefix("textures/entity/jungle_spider/harmful.png");
Expand All @@ -23,8 +24,9 @@ public JungleSpiderHarmfulPatternLayer(RenderLayerParent<T, M> parent) {
@Override
public void render(@NotNull PoseStack pPoseStack, @NotNull MultiBufferSource pBuffer, int pPackedLight, @NotNull T jungleSpider, float pLimbSwing, float pLimbSwingAmount, float pPartialTick, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) {
MobEffect mobEffect = jungleSpider.getHarmfulVenomEffect();
Color effectColor = Color.ofOpaque(mobEffect.getColor()).brighter(1.3F);
//Color effectColor = Color.ofOpaque(mobEffect.getColor()).brighter(1.3F);
Color color = new Color(0xFF000000 | mobEffect.getColor()).brighter();
VertexConsumer vertexConsumer = pBuffer.getBuffer(RenderType.entityTranslucent(HARMFUL_LAYER));
this.getParentModel().renderToBuffer(pPoseStack,vertexConsumer, pPackedLight, LivingEntityRenderer.getOverlayCoords(jungleSpider, 0.0F), effectColor.getRedFloat(), effectColor.getGreenFloat(), effectColor.getBlueFloat(), 1.0F);
this.getParentModel().renderToBuffer(pPoseStack,vertexConsumer, pPackedLight, LivingEntityRenderer.getOverlayCoords(jungleSpider, 0.0F), (float) color.getRed() / 255, (float) color.getGreen() / 255, (float) color.getBlue() / 255, 1.0F);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.core.animation.RawAnimation;

import java.util.EnumSet;
import java.util.List;
Expand Down
44 changes: 24 additions & 20 deletions src/main/java/com/uraneptus/sullysmod/common/entities/Tortoise.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.core.animatable.GeoAnimatable;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;

import java.util.List;

Expand All @@ -65,23 +56,23 @@ public class Tortoise extends Animal implements WorkstationAttachable {
private static final EntityDataAccessor<ItemStack> WORKSTATION = SynchedEntityData.defineId(Tortoise.class, EntityDataSerializers.ITEM_STACK);
private static final EntityDataAccessor<ItemStack> RECORD_ITEM = SynchedEntityData.defineId(Tortoise.class, EntityDataSerializers.ITEM_STACK);
public static final Ingredient FOOD_ITEMS = Ingredient.of(SMItemTags.TORTOISE_FOOD);
protected static final RawAnimation WALKING_ANIM = RawAnimation.begin().thenLoop("animation.tortoise.walking");
protected static final RawAnimation HIDING_ANIM = RawAnimation.begin().thenPlayAndHold("animation.tortoise.hide").thenLoop("animation.tortoise.hiding");
protected static final RawAnimation REVEAL_ANIM = RawAnimation.begin().thenPlayAndHold("animation.tortoise.reveal");
int layEggCounter;
FollowJukeboxEntitySoundInstance soundInstance;
long recordTickCount;
long recordStartedTick;
boolean isPlaying;
int ticksSinceLastEvent;
public final AnimationState hideState = new AnimationState();
public final AnimationState hiddenState = new AnimationState();
public final AnimationState reveal_state = new AnimationState();
private int layEggCounter;
private FollowJukeboxEntitySoundInstance soundInstance;
private long recordTickCount;
private long recordStartedTick;
private boolean isPlaying;
private int ticksSinceLastEvent;

public Tortoise(EntityType<? extends Animal> entityType, Level level) {
super(entityType, level);
}

public static AttributeSupplier.Builder createAttributes() {
return Mob.createMobAttributes()
.add(Attributes.MOVEMENT_SPEED, 0.275D)
.add(Attributes.MOVEMENT_SPEED, 0.25D)
.add(Attributes.MAX_HEALTH, 30.0D);
}

Expand Down Expand Up @@ -168,7 +159,7 @@ public void onClientRemoval() {
public void tick() {
super.tick();
Level level = this.level();

System.out.println(this.getHideTimerDuration());
this.handleJukeboxTick(this, level);

//Hiding core stuff
Expand Down Expand Up @@ -205,6 +196,19 @@ public void tick() {
}
}

if (level().isClientSide()) {
this.hideState.animateWhen(this.getHideTimerDuration() > 1, this.tickCount);

this.hideState.ifStarted(a -> {
this.hiddenState.start(this.tickCount);
this.hiddenState.stop();
});
if (this.getHideTimerDuration() == 2) {
this.hideState.stop();
this.hiddenState.stop();
}
this.reveal_state.animateWhen(!this.hiddenState.isStarted() && !this.hideState.isStarted(), this.tickCount);
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraftforge.registries.ForgeRegistries;
import software.bernie.geckolib.core.object.Color;

import javax.annotation.Nullable;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -122,11 +122,13 @@ private static MobEffect getHarmfulEffect(ItemStack stack) {
public static int getEffectColours(ItemStack stack, int tintIndex) {
Color effectColor;
if (tintIndex == 1) {
effectColor = Color.ofOpaque(getBeneficialEffect(stack).getColor()).brighter(1.3F);
//effectColor = Color.ofOpaque(getBeneficialEffect(stack).getColor()).brighter(1.3F);
effectColor = new Color(0xFF000000 | getBeneficialEffect(stack).getColor());
}
else {
effectColor = Color.ofOpaque(getHarmfulEffect(stack).getColor()).brighter(1.3F);
//effectColor = Color.ofOpaque(getHarmfulEffect(stack).getColor()).brighter(1.3F);
effectColor = new Color(0xFF000000 | getHarmfulEffect(stack).getColor()).brighter();
}
return effectColor.getColor();
return effectColor.getRGB();
}
}
7 changes: 0 additions & 7 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ displayTest = "MATCH_VERSION"
ordering = "BEFORE"
side = "BOTH"

[[dependencies.sullysmod]]
modId = "geckolib"
mandatory = true
versionRange = "[4.2.2,)"
ordering = "BEFORE"
side = "BOTH"

[modproperties.sullysmod]
catalogueImageIcon = "sullysmod_icon.png"
configuredBackground = "sullysmod:textures/block/polished_jade_bricks.png"
Loading

0 comments on commit a206aa3

Please sign in to comment.