-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
we have working localized time dilation :3
- Loading branch information
1 parent
e745a4f
commit e54dac4
Showing
5 changed files
with
95 additions
and
84 deletions.
There are no files selected for viewing
30 changes: 0 additions & 30 deletions
30
src/main/java/dev/cammiescorner/arcanuscontinuum/mixin/client/AbstractClientPlayerMixin.java
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
src/main/java/dev/cammiescorner/arcanuscontinuum/mixin/client/TimerMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package dev.cammiescorner.arcanuscontinuum.mixin.client; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.Timer; | ||
import net.minecraft.client.player.LocalPlayer; | ||
import net.minecraft.world.phys.Vec3; | ||
import org.spongepowered.asm.mixin.*; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(Timer.class) | ||
public abstract class TimerMixin { | ||
@Shadow @Final @Mutable private float msPerTick; | ||
@Unique float ticksPerSecond; | ||
|
||
@Inject(method = "<init>", at = @At("TAIL")) | ||
private void captureTickRate(float ticksPerSecond, long lastMs, CallbackInfo info) { | ||
this.ticksPerSecond = ticksPerSecond; | ||
} | ||
|
||
@Inject(method = "advanceTime", at = @At("HEAD")) | ||
private void slowDownTicks(long gameTime, CallbackInfoReturnable<Integer> info) { | ||
LocalPlayer player = Minecraft.getInstance().player; | ||
|
||
// TODO tie to being in a time dilation entity | ||
if(player != null && player.position().distanceTo(new Vec3(0, 146, 0)) < 16) | ||
msPerTick = 1000f / (ticksPerSecond / 2f); | ||
else | ||
msPerTick = 1000f / ticksPerSecond; | ||
} | ||
} |
11 changes: 9 additions & 2 deletions
11
src/main/java/dev/cammiescorner/arcanuscontinuum/mixin/common/EntityMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
package dev.cammiescorner.arcanuscontinuum.mixin.common; | ||
|
||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.phys.Vec3; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(Entity.class) | ||
public class EntityMixin { | ||
public abstract class EntityMixin { | ||
@Shadow public abstract Vec3 position(); | ||
|
||
@ModifyVariable(method = "playSound(Lnet/minecraft/sounds/SoundEvent;FF)V", at = @At("HEAD"), argsOnly = true, ordinal = 1) | ||
private float pitchDown(float pitch) { | ||
return pitch * 0.5f; // TODO tie to being in a time dilation entity | ||
if(position().distanceTo(new Vec3(0, 146, 0)) < 16) | ||
return pitch * 0.5f; // TODO tie to being in a time dilation entity | ||
|
||
return pitch; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "dev.cammiescorner.arcanuscontinuum.mixin", | ||
"plugin": "dev.cammiescorner.arcanuscontinuum.ArcanusMixinConfig", | ||
"compatibilityLevel": "JAVA_${java_version}", | ||
"mixins": [ | ||
"common.AbstractArrowMixin", | ||
"common.ArmorStandMixin", | ||
"common.BlockStateBaseMixin", | ||
"common.EnderDragonPartMixin", | ||
"common.EntityGetterMixin", | ||
"common.EntityMixin", | ||
"common.ExplosionMixin", | ||
"common.FallingBlockMixin", | ||
"common.FoodDataMixin", | ||
"common.ItemEntityMixin", | ||
"common.ItemStackMixin", | ||
"common.LecternBlockEntityMixin", | ||
"common.LevelMixin", | ||
"common.LivingEntityMixin", | ||
"common.MenuTypeMixin", | ||
"common.MilkBucketItemMixin", | ||
"common.MobMixin", | ||
"common.PistonBaseBlockMixin", | ||
"common.PlayerListMixin", | ||
"common.PlayerMixin", | ||
"common.ServerLevelMixin", | ||
"common.ThrowableProjectileMixin", | ||
"compat.pehkui.LivingEntityMixin", | ||
"datagen.AdvancementBuilderMixin", | ||
"datagen.FabricDynamicRegistryProviderEntriesMixin", | ||
"datagen.RegistrySetBuilderMixin" | ||
], | ||
"client": [ | ||
"client.AbstractClientPlayerMixin", | ||
"client.ClientLevelMixin", | ||
"client.CraftingScreenMixin", | ||
"client.GuiMixin", | ||
"client.HumanoidModelMixin", | ||
"client.ItemInHandLayerMixin", | ||
"client.ItemInHandRendererMixin", | ||
"client.ItemRendererMixin", | ||
"client.LevelRendererMixin", | ||
"client.LivingEntityRendererMixin", | ||
"client.MinecraftMixin", | ||
"client.MouseHandlerMixin", | ||
"client.PlayerRendererMixin", | ||
"client.RenderTargetMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "dev.cammiescorner.arcanuscontinuum.mixin", | ||
"plugin": "dev.cammiescorner.arcanuscontinuum.ArcanusMixinConfig", | ||
"compatibilityLevel": "JAVA_${java_version}", | ||
"mixins": [ | ||
"common.AbstractArrowMixin", | ||
"common.ArmorStandMixin", | ||
"common.BlockStateBaseMixin", | ||
"common.EnderDragonPartMixin", | ||
"common.EntityGetterMixin", | ||
"common.EntityMixin", | ||
"common.ExplosionMixin", | ||
"common.FallingBlockMixin", | ||
"common.FoodDataMixin", | ||
"common.ItemEntityMixin", | ||
"common.ItemStackMixin", | ||
"common.LecternBlockEntityMixin", | ||
"common.LevelMixin", | ||
"common.LivingEntityMixin", | ||
"common.MenuTypeMixin", | ||
"common.MilkBucketItemMixin", | ||
"common.MobMixin", | ||
"common.PistonBaseBlockMixin", | ||
"common.PlayerListMixin", | ||
"common.PlayerMixin", | ||
"common.ServerLevelMixin", | ||
"common.ThrowableProjectileMixin", | ||
"compat.pehkui.LivingEntityMixin", | ||
"datagen.AdvancementBuilderMixin", | ||
"datagen.FabricDynamicRegistryProviderEntriesMixin", | ||
"datagen.RegistrySetBuilderMixin" | ||
], | ||
"client": [ | ||
"client.ClientLevelMixin", | ||
"client.CraftingScreenMixin", | ||
"client.GuiMixin", | ||
"client.HumanoidModelMixin", | ||
"client.ItemInHandLayerMixin", | ||
"client.ItemInHandRendererMixin", | ||
"client.ItemRendererMixin", | ||
"client.LevelRendererMixin", | ||
"client.LivingEntityRendererMixin", | ||
"client.MinecraftMixin", | ||
"client.MouseHandlerMixin", | ||
"client.PlayerRendererMixin", | ||
"client.RenderTargetMixin", | ||
"client.TimerMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |