Skip to content

Commit fb4fb67

Browse files
Merge branch '1.21.11' into 26.1
2 parents 3fed0a5 + ef304da commit fb4fb67

File tree

11 files changed

+297
-172
lines changed

11 files changed

+297
-172
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ Thank you!
33
Put the changelog BELOW the dashes. ANYTHING ABOVE IS IGNORED
44
hi
55
-----------------
6-
- Ported to 26.1-snapshot-1
6+
- Fixed an issue that prevented the Rebrush enchantment from working properly.
7+
- Fixed Brush animations in the third person moving very rapidly.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ loader_version=0.18.4
1414

1515
# Mod Properties
1616
mod_id = trailiertales
17-
mod_version = 1.2
17+
mod_version = 1.2.2
1818
# protocol version must be changed after each update with dual env changes
1919
protocol_version = 3
2020
maven_group = net.frozenblock

src/main/java/net/frozenblock/trailiertales/entity/ai/apparition/ApparitionAi.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ public class ApparitionAi {
6767
TTSensorTypes.APPARITION_AIDABLES_SENSOR
6868
);
6969
public static final List<MemoryModuleType<?>> MEMORY_TYPES = List.of(
70-
TTMemoryModuleTypes.AID_COOLDOWN,
7170
TTMemoryModuleTypes.AIDING_TIME,
72-
TTMemoryModuleTypes.NEARBY_AIDABLES,
73-
TTMemoryModuleTypes.NEAREST_AIDABLE,
7471
TTMemoryModuleTypes.SEE_TIME,
7572
TTMemoryModuleTypes.STRAFING_CLOCKWISE,
7673
TTMemoryModuleTypes.STRAFING_BACKWARDS,

src/main/java/net/frozenblock/trailiertales/entity/ai/apparition/ApparitionHaunt.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected void tick(ServerLevel level, Apparition apparition, long timestamp) {
5858
if (livingEntity == null) return;
5959

6060
int hauntingTicks = brain.getMemory(TTMemoryModuleTypes.HAUNTING_TICKS).orElse(0);
61-
if (!livingEntity.getBoundingBox().intersects(apparition.getAttackBoundingBox(0D))) {
61+
if (livingEntity.getBoundingBox().intersects(apparition.getAttackBoundingBox(0D))) {
6262
hauntingTicks += 2;
6363
if (hauntingTicks >= 150) {
6464
apparition.playSound(TTSounds.APPARITION_HAUNT, apparition.getSoundVolume(), apparition.getVoicePitch());

src/main/java/net/frozenblock/trailiertales/mixin/client/brush/ItemInHandLayerMixin.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import net.fabricmc.api.EnvType;
2323
import net.fabricmc.api.Environment;
2424
import net.frozenblock.trailiertales.config.TTItemConfig;
25-
import net.minecraft.client.Minecraft;
2625
import net.minecraft.client.model.ArmedModel;
2726
import net.minecraft.client.model.EntityModel;
2827
import net.minecraft.client.renderer.SubmitNodeCollector;
@@ -69,12 +68,10 @@ public abstract class ItemInHandLayerMixin<S extends ArmedEntityRenderState, M e
6968
&& TTItemConfig.SMOOTH_BRUSH_ANIMATION
7069
&& humanoidState.isUsingItem
7170
&& humanoidState.useItemHand == interactionHand
72-
&& humanoidState.attackTime < 1.0E-5F
71+
&& humanoidState.attackTime <= 0F
7372
&& stack.is(Items.BRUSH)
7473
) {
75-
final float remainingTicks = humanoidState.ticksUsingItem + 1F;
76-
final float partialTick = Minecraft.getInstance().getDeltaTracker().getGameTimeDeltaPartialTick(true);
77-
final float brushProgress = remainingTicks + partialTick;
74+
final float brushProgress = humanoidState.ticksUsingItem + 1F;
7875
final float brushRoll = Mth.cos((brushProgress * Mth.PI) / 5F) * 1.2F;
7976
final Axis axis = arm == HumanoidArm.LEFT ? Axis.ZP : Axis.ZN;
8077
poseStack.mulPose(axis.rotation(brushRoll));

src/main/java/net/frozenblock/trailiertales/mixin/common/brushable_block/BrushableBlockEntityMixin.java

Lines changed: 31 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import net.minecraft.world.level.storage.loot.LootTable;
4646
import org.jetbrains.annotations.Contract;
4747
import org.jetbrains.annotations.Nullable;
48-
import org.objectweb.asm.Opcodes;
4948
import org.spongepowered.asm.mixin.Mixin;
5049
import org.spongepowered.asm.mixin.Shadow;
5150
import org.spongepowered.asm.mixin.Unique;
@@ -63,11 +62,11 @@ public abstract class BrushableBlockEntityMixin extends BlockEntity implements B
6362
@Unique
6463
private float trailierTales$prevXLerp = 0.5F;
6564
@Unique
66-
private float trailierTales$targetYLerp = 0.0F;
65+
private float trailierTales$targetYLerp = 0F;
6766
@Unique
68-
private float trailierTales$yLerp = 0.0F;
67+
private float trailierTales$yLerp = 0F;
6968
@Unique
70-
private float trailierTales$prevYLerp = 0.0F;
69+
private float trailierTales$prevYLerp = 0F;
7170
@Unique
7271
private float trailierTales$targetZLerp = 0.5F;
7372
@Unique
@@ -144,41 +143,29 @@ public BrushableBlockEntityMixin(BlockEntityType<?> type, BlockPos pos, BlockSta
144143
public void trailierTales$saveAdditional(ValueOutput output, CallbackInfo info) {
145144
this.trailierTales$saveTT(output);
146145
if (this.trailierTales$rebrushed) output.putBoolean("Rebrushed", this.trailierTales$rebrushed);
147-
if (this.trailierTales$storedLootTable != null && this.trailierTales$storedLootTable != this.lootTable) {
148-
output.putString("TrailierTalesStoredLootTable", this.trailierTales$storedLootTable.identifier().toString());
149-
}
146+
if (this.trailierTales$storedLootTable != null) output.store("TrailierTalesStoredLootTable", LootTable.KEY_CODEC, this.trailierTales$storedLootTable);
150147
}
151148

152-
@Unique
153-
private boolean trailierTales$runRebrush;
154-
155-
@Inject(
156-
method = "brush",
149+
@WrapOperation(
150+
method = "brushingCompleted",
157151
at = @At(
158152
value = "INVOKE",
159-
target = "Lnet/minecraft/world/level/block/entity/BrushableBlockEntity;brushingCompleted(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/item/ItemStack;)V",
160-
shift = At.Shift.BEFORE
153+
target = "Lnet/minecraft/world/level/block/BrushableBlock;getTurnsInto()Lnet/minecraft/world/level/block/Block;"
161154
)
162155
)
163-
public void trailierTales$rebrushA(long ticks, ServerLevel level, LivingEntity entity, Direction direction, ItemStack stack, CallbackInfoReturnable<Boolean> info) {
164-
if (this.trailierTales$hasCustomItem) return;
156+
private Block trailierTales$runRebrush(
157+
BrushableBlock instance, Operation<Block> original,
158+
ServerLevel level, LivingEntity entity, ItemStack stack
159+
) {
160+
if (this.trailierTales$hasCustomItem) return original.call(instance);
165161

166162
final int rebrushLevel = stack.getEnchantments().getLevel(entity.level().registryAccess().lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(TTEnchantments.REBRUSH));
167-
if (rebrushLevel <= 0) return;
163+
if (rebrushLevel <= 0) return original.call(instance);
168164

169165
final float rebrushChance = this.trailierTales$rebrushed ? 0.05F * rebrushLevel : 0.1F * rebrushLevel;
170-
if (entity.getRandom().nextFloat() < rebrushChance) this.trailierTales$runRebrush = true;
171-
}
166+
final boolean rebrush = entity.getRandom().nextFloat() < rebrushChance;
167+
if (this.trailierTales$hasCustomItem || !rebrush) return original.call(instance);
172168

173-
@WrapOperation(
174-
method = "brushingCompleted",
175-
at = @At(
176-
value = "INVOKE",
177-
target = "Lnet/minecraft/world/level/block/BrushableBlock;getTurnsInto()Lnet/minecraft/world/level/block/Block;"
178-
)
179-
)
180-
private Block trailierTales$runRebrush(BrushableBlock instance, Operation<Block> original) {
181-
if (!this.trailierTales$runRebrush) return original.call(instance);
182169
this.trailierTales$rebrushed = true;
183170
this.lootTable = this.trailierTales$storedLootTable;
184171
this.brushCount = 0;
@@ -197,28 +184,18 @@ public BrushableBlockEntityMixin(BlockEntityType<?> type, BlockPos pos, BlockSta
197184
this.trailierTales$targetItemScale = 0F;
198185
this.trailierTales$itemScale = 0F;
199186
this.trailierTales$prevItemScale = 0F;
200-
this.trailierTales$runRebrush = false;
201-
this.item = ItemStack.EMPTY;
202187
this.lootTableSeed = 0L;
203188
return instance;
204189
}
205190

206-
@Inject(
207-
method = "tryLoadLootTable",
208-
at = @At(
209-
value = "FIELD",
210-
target = "Lnet/minecraft/world/level/block/entity/BrushableBlockEntity;lootTable:Lnet/minecraft/resources/ResourceKey;",
211-
opcode = Opcodes.PUTFIELD,
212-
shift = At.Shift.AFTER
213-
)
214-
)
191+
@Inject(method = "tryLoadLootTable", at = @At(value = "RETURN"))
215192
private void trailierTales$storeLootTable(ValueInput valueInput, CallbackInfoReturnable<Boolean> info) {
216193
this.trailierTales$storedLootTable = this.lootTable;
217194
}
218195

219196
@Inject(method = "setLootTable", at = @At("HEAD"))
220197
public void trailierTales$setLootTable(ResourceKey<LootTable> lootTable, long lootTableSeed, CallbackInfo info) {
221-
if (lootTable != null) this.trailierTales$storedLootTable = lootTable;;
198+
if (lootTable != null) this.trailierTales$storedLootTable = lootTable;
222199
}
223200

224201
@Unique
@@ -308,20 +285,20 @@ public BrushableBlockEntityMixin(BlockEntityType<?> type, BlockPos pos, BlockSta
308285
@Unique
309286
public void trailierTales$readTT(ValueInput input) {
310287
this.trailierTales$hitDirection = Direction.byName(input.getStringOr("TTHitDirection", ""));
311-
this.trailierTales$targetXLerp = input.getFloatOr("TargetXLerp", 0);
312-
this.trailierTales$targetYLerp = input.getFloatOr("TargetYLerp", 0);
313-
this.trailierTales$targetZLerp = input.getFloatOr("TargetZLerp", 0);
314-
this.trailierTales$xLerp = input.getFloatOr("XLerp", 0);
315-
this.trailierTales$yLerp = input.getFloatOr("YLerp", 0);
316-
this.trailierTales$zLerp = input.getFloatOr("ZLerp", 0);
317-
this.trailierTales$prevXLerp = input.getFloatOr("PrevXLerp", 0);
318-
this.trailierTales$prevYLerp = input.getFloatOr("PrevYLerp", 0);
319-
this.trailierTales$prevZLerp = input.getFloatOr("PrevZLerp", 0);
320-
this.trailierTales$targetItemScale = input.getFloatOr("TargetItemScale", 0);
321-
this.trailierTales$itemScale = input.getFloatOr("ItemScale", 0);
322-
this.trailierTales$prevItemScale = input.getFloatOr("PrevItemScale", 0);
323-
this.trailierTales$rotation = input.getFloatOr("Rotation", 0);
324-
this.trailierTales$prevRotation = input.getFloatOr("PrevRotation", 0);
288+
this.trailierTales$targetXLerp = input.getFloatOr("TargetXLerp", 0.5F);
289+
this.trailierTales$targetYLerp = input.getFloatOr("TargetYLerp", 0F);
290+
this.trailierTales$targetZLerp = input.getFloatOr("TargetZLerp", 0.5F);
291+
this.trailierTales$xLerp = input.getFloatOr("XLerp", 0.5F);
292+
this.trailierTales$yLerp = input.getFloatOr("YLerp", 0F);
293+
this.trailierTales$zLerp = input.getFloatOr("ZLerp", 0.5F);
294+
this.trailierTales$prevXLerp = input.getFloatOr("PrevXLerp", 0.5F);
295+
this.trailierTales$prevYLerp = input.getFloatOr("PrevYLerp", 0F);
296+
this.trailierTales$prevZLerp = input.getFloatOr("PrevZLerp", 0.5F);
297+
this.trailierTales$targetItemScale = input.getFloatOr("TargetItemScale", 0F);
298+
this.trailierTales$itemScale = input.getFloatOr("ItemScale", 0F);
299+
this.trailierTales$prevItemScale = input.getFloatOr("PrevItemScale", 0F);
300+
this.trailierTales$rotation = input.getFloatOr("Rotation", 0F);
301+
this.trailierTales$prevRotation = input.getFloatOr("PrevRotation", 0F);
325302
this.trailierTales$hasCustomItem = input.getBooleanOr("HasCustomItem", false);
326303
this.brushCount = input.getIntOr("BrushCount", 0);
327304
}

src/main/java/net/frozenblock/trailiertales/registry/TTEnchantments.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ public final class TTEnchantments {
3838
public static final ResourceKey<Enchantment> REAPING = key("reaping");
3939

4040
public static void bootstrap(BootstrapContext<Enchantment> context) {
41-
final HolderGetter<DamageType> damageTypeHolder = context.lookup(Registries.DAMAGE_TYPE);
42-
final HolderGetter<Enchantment> enchantmentHolder = context.lookup(Registries.ENCHANTMENT);
43-
final HolderGetter<Item> itemHolder = context.lookup(Registries.ITEM);
44-
final HolderGetter<Block> blockHolder = context.lookup(Registries.BLOCK);
41+
final HolderGetter<DamageType> damageTypes = context.lookup(Registries.DAMAGE_TYPE);
42+
final HolderGetter<Enchantment> enchantments = context.lookup(Registries.ENCHANTMENT);
43+
final HolderGetter<Item> items = context.lookup(Registries.ITEM);
44+
final HolderGetter<Block> blocks = context.lookup(Registries.BLOCK);
4545

4646
register(
4747
context,
4848
REBRUSH,
4949
Enchantment.enchantment(
5050
Enchantment.definition(
51-
itemHolder.getOrThrow(TTItemTags.BRUSH_ENCHANTABLE),
51+
items.getOrThrow(TTItemTags.BRUSH_ENCHANTABLE),
5252
2,
5353
3,
5454
Enchantment.dynamicCost(25, 25),
@@ -64,7 +64,7 @@ public static void bootstrap(BootstrapContext<Enchantment> context) {
6464
REAPING,
6565
Enchantment.enchantment(
6666
Enchantment.definition(
67-
itemHolder.getOrThrow(ItemTags.WEAPON_ENCHANTABLE),
67+
items.getOrThrow(ItemTags.WEAPON_ENCHANTABLE),
6868
2,
6969
3,
7070
Enchantment.dynamicCost(25, 25),

0 commit comments

Comments
 (0)