Skip to content

Commit 090049c

Browse files
committed
Blackened retexture and attack anims, changed gunpowder recipe
1 parent 2fdf206 commit 090049c

10 files changed

Lines changed: 62 additions & 47 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ dependencies {
5353
modImplementation "io.github.prospector:modmenu:1.14.13+build.21"
5454

5555
modRuntime "me.shedaniel:RoughlyEnoughItems:5.8.9"
56-
modRuntime "grondag:canvas-mc116:1.0.1267"
56+
//modRuntime "grondag:canvas-mc116:1.0.1267"
5757

5858
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
5959
// You may need to force-disable transitiveness on them.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
88
loader_version=0.11.1
99

1010
# Mod Properties
11-
mod_version = 1.1.0
11+
mod_version = 1.1.1
1212
maven_group = raltsmc.desolation
1313
archives_base_name = desolation
1414

src/main/java/raltsmc/desolation/entity/BlackenedEntity.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
public class BlackenedEntity extends HostileEntity implements IAnimatable {
3636
private static final TrackedData<Boolean> MELEE_ATTACKING;
37-
private static final TrackedData<Boolean> THROW_ATTACKING;
37+
private static final TrackedData<Boolean> ASH_ATTACKING;
3838

3939
public BlackenedEntity(EntityType<? extends HostileEntity> entityType, World world) {
4040
super(entityType, world);
@@ -66,7 +66,7 @@ public static DefaultAttributeContainer.Builder createBlackenedAttributes() {
6666
protected void initDataTracker() {
6767
super.initDataTracker();
6868
this.dataTracker.startTracking(MELEE_ATTACKING, false);
69-
this.dataTracker.startTracking(THROW_ATTACKING, false);
69+
this.dataTracker.startTracking(ASH_ATTACKING, false);
7070
}
7171

7272
protected void playStepSound(BlockPos pos, BlockState state) {
@@ -114,15 +114,15 @@ public boolean isMeleeAttacking() {
114114
}
115115

116116
public boolean isAshAttacking() {
117-
return (Boolean)this.dataTracker.get(THROW_ATTACKING);
117+
return (Boolean)this.dataTracker.get(ASH_ATTACKING);
118118
}
119119

120120
public void setMeleeAttacking(boolean val) {
121121
this.dataTracker.set(MELEE_ATTACKING, val);
122122
}
123123

124124
public void setAshAttacking(boolean val) {
125-
this.dataTracker.set(MELEE_ATTACKING, val);
125+
this.dataTracker.set(ASH_ATTACKING, val);
126126
}
127127

128128
private <E extends IAnimatable>PlayState idlePredicate(AnimationEvent<E> event) {
@@ -150,16 +150,13 @@ private <E extends IAnimatable>PlayState heartPredicate(AnimationEvent<E> event)
150150

151151
private <E extends IAnimatable>PlayState attackPredicate(AnimationEvent<E> event) {
152152
if (this.isMeleeAttacking()) {
153-
event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.desolation.blackened_melee"));
154-
this.setMeleeAttacking(false);
153+
event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.desolation.blackened_melee", true));
155154
return PlayState.CONTINUE;
156155
} else if (this.isAshAttacking()) {
157-
event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.desolation.blackened_throw"));
158-
this.setAshAttacking(false);
156+
event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.desolation.blackened_throw", true));
159157
return PlayState.CONTINUE;
160-
} else {
161-
return PlayState.STOP;
162158
}
159+
return PlayState.STOP;
163160
}
164161

165162
@Override
@@ -172,6 +169,6 @@ public void registerControllers(AnimationData data) {
172169

173170
static {
174171
MELEE_ATTACKING = DataTracker.registerData(BlackenedEntity.class, TrackedDataHandlerRegistry.BOOLEAN);
175-
THROW_ATTACKING = DataTracker.registerData(BlackenedEntity.class, TrackedDataHandlerRegistry.BOOLEAN);
172+
ASH_ATTACKING = DataTracker.registerData(BlackenedEntity.class, TrackedDataHandlerRegistry.BOOLEAN);
176173
}
177174
}

src/main/java/raltsmc/desolation/entity/ai/goal/AshAttackGoal.java

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,16 @@ public class AshAttackGoal extends Goal {
5959
private double targetY;
6060
private double targetZ;
6161
private int updateCountdownTicks;
62-
private int field_24667;
62+
private int attackCd;
6363
private final int attackIntervalTicks = 20;
6464
private long lastUpdateTime;
65+
private AttackType lastAttack;
66+
67+
private enum AttackType {
68+
MELEE,
69+
ASH,
70+
NONE
71+
}
6572

6673
public AshAttackGoal(BlackenedEntity mob, double speed, boolean pauseWhenMobIdle) {
6774
this.mob = mob;
@@ -119,7 +126,8 @@ public void start() {
119126
this.mob.getNavigation().startMovingAlong(this.path, this.speed);
120127
this.mob.setAttacking(true);
121128
this.updateCountdownTicks = 0;
122-
this.field_24667 = 0;
129+
this.attackCd = 0;
130+
this.lastAttack = AttackType.NONE;
123131
}
124132

125133
public void stop() {
@@ -129,6 +137,8 @@ public void stop() {
129137
}
130138

131139
this.mob.setAttacking(false);
140+
this.mob.setMeleeAttacking(false);
141+
this.mob.setAshAttacking(false);
132142
this.mob.getNavigation().stop();
133143
}
134144

@@ -153,50 +163,53 @@ public void tick() {
153163
}
154164
}
155165

156-
this.field_24667 = Math.max(this.field_24667 - 1, 0);
166+
this.attackCd = Math.max(this.attackCd - 1, 0);
157167
this.attack(livingEntity, d);
158168
}
159169

160170
protected void attack(LivingEntity target, double squaredDistance) {
161171
double d = this.getSquaredMaxAttackDistance(target);
162172
double e = this.getSquaredCloseAttackDistance(target);
163-
if (this.field_24667 <= 0) {
164-
if (squaredDistance <= e) {
165-
this.method_28346();
166-
this.mob.swingHand(Hand.MAIN_HAND);
167-
this.mob.setMeleeAttacking(true);
168-
this.mob.tryAttack(target);
169-
} else if (squaredDistance <= d) {
170-
this.method_28346();
171-
this.mob.swingHand(Hand.MAIN_HAND);
172-
this.mob.setAshAttacking(true);
173-
this.mob.tryAshAttack(target);
174-
}
173+
if (squaredDistance <= e &&
174+
(this.lastAttack == AttackType.NONE && this.getAttackCd() <= 0) ||
175+
(this.lastAttack == AttackType.MELEE && this.getAttackCd() <= 0) ||
176+
(this.lastAttack == AttackType.ASH && this.getAttackCd() <= 30)) {
177+
this.resetAttackCd();
178+
this.mob.swingHand(Hand.MAIN_HAND);
179+
this.mob.setMeleeAttacking(true);
180+
this.mob.setAshAttacking(false);
181+
this.lastAttack = AttackType.MELEE;
182+
this.mob.tryAttack(target);
183+
} else if (squaredDistance <= d &&
184+
(this.lastAttack == AttackType.NONE && this.getAttackCd() <= 0) ||
185+
(this.lastAttack == AttackType.MELEE && this.getAttackCd() <= 30) ||
186+
(this.lastAttack == AttackType.ASH && this.getAttackCd() <= 0)) {
187+
this.resetAttackCd();
188+
this.mob.swingHand(Hand.MAIN_HAND);
189+
this.mob.setAshAttacking(true);
190+
this.mob.setMeleeAttacking(false);
191+
this.lastAttack = AttackType.ASH;
192+
this.mob.tryAshAttack(target);
193+
} else if (squaredDistance > d || this.getAttackCd() <= 0) {
194+
this.mob.setAshAttacking(false);
195+
this.mob.setMeleeAttacking(false);
196+
this.lastAttack = AttackType.NONE;
175197
}
176-
177-
}
178-
179-
protected void method_28346() {
180-
this.field_24667 = 40;
181-
}
182-
183-
protected boolean method_28347() {
184-
return this.field_24667 <= 0;
185198
}
186199

187-
protected int method_28348() {
188-
return this.field_24667;
200+
protected void resetAttackCd() {
201+
this.attackCd = 60;
189202
}
190203

191-
protected int method_28349() {
192-
return 20;
204+
protected int getAttackCd() {
205+
return this.attackCd;
193206
}
194207

195208
protected double getSquaredMaxAttackDistance(LivingEntity entity) {
196209
return (double)(this.mob.getWidth() * 4.0F * this.mob.getWidth() * 4.0F + entity.getWidth());
197210
}
198211

199212
protected double getSquaredCloseAttackDistance(LivingEntity entity) {
200-
return (double)(this.mob.getWidth() * 1.5F * this.mob.getWidth() * 1.5F + entity.getWidth());
213+
return (double)(this.mob.getWidth() * 2.0F * this.mob.getWidth() * 2.0F + entity.getWidth());
201214
}
202215
}

src/main/java/raltsmc/desolation/world/feature/DesolationConfiguredFeatures.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public final class DesolationConfiguredFeatures {
125125
(ConfiguredFeature)DesolationFeatures.SCATTERED
126126
.configure(Configs.EMBER_CHUNK_CONFIG)
127127
.decorate(ConfiguredFeatures.Decorators.SQUARE_HEIGHTMAP_SPREAD_DOUBLE)
128-
.repeat(5), "patch_ember_chunk");
128+
.repeat(4), "patch_ember_chunk");
129129

130130
public static final ConfiguredFeature<FeatureConfig, ?> PATCH_ASH_BRAMBLE = register(
131131
(ConfiguredFeature)Feature.RANDOM_PATCH
-210 KB
Binary file not shown.
62 Bytes
Loading

src/main/resources/data/desolation/loot_tables/chests/ash_tinker_base.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
},
8686
{
8787
"type": "minecraft:item",
88-
"weight": 10,
88+
"weight": 6,
8989
"functions": [
9090
{
9191
"function": "minecraft:set_count",
@@ -105,8 +105,13 @@
105105
},
106106
{
107107
"type": "minecraft:item",
108-
"weight": 2,
108+
"weight": 5,
109109
"name": "desolation:goggles"
110+
},
111+
{
112+
"type": "minecraft:item",
113+
"weight": 2,
114+
"name": "desolation:music_disc_ashes"
110115
}
111116
]
112117
},

src/main/resources/data/desolation/recipes/gunpowder.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"item": "minecraft:bone_meal"
99
},
1010
{
11-
"item": "minecraft:clay"
11+
"item": "minecraft:clay_ball"
1212
}
1313
],
1414
"result": {

src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"schemaVersion": 1,
33
"id": "desolation",
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55

66
"name": "Desolation",
77
"description": "Wildfires bring both destruction and renewal.",

0 commit comments

Comments
 (0)