-
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.
rename mixins, and start on time dilation effect
- Loading branch information
1 parent
b253cca
commit f466b6e
Showing
17 changed files
with
80 additions
and
114 deletions.
There are no files selected for viewing
22 changes: 14 additions & 8 deletions
22
src/main/java/dev/cammiescorner/arcanuscontinuum/mixin/common/AbstractArrowMixin.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,19 +1,25 @@ | ||
package dev.cammiescorner.arcanuscontinuum.mixin.common; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import dev.cammiescorner.arcanuscontinuum.common.entities.magic.MagicProjectileEntity; | ||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.entity.projectile.AbstractArrow; | ||
import net.minecraft.world.phys.Vec3; | ||
import net.minecraft.world.entity.projectile.Projectile; | ||
import net.minecraft.world.level.Level; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(AbstractArrow.class) | ||
public class AbstractArrowMixin { | ||
@WrapOperation(method = "tick", at = @At( | ||
public abstract class AbstractArrowMixin extends Projectile { | ||
public AbstractArrowMixin(EntityType<? extends Projectile> entityType, Level world) { | ||
super(entityType, world); | ||
} | ||
|
||
@ModifyExpressionValue(method = "tick", at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/world/entity/projectile/AbstractArrow;getDeltaMovement()Lnet/minecraft/world/phys/Vec3;" | ||
target = "Lnet/minecraft/world/entity/player/Player;canHarmPlayer(Lnet/minecraft/world/entity/player/Player;)Z" | ||
)) | ||
private Vec3 pleaseWork(AbstractArrow instance, Operation<Vec3> original) { | ||
return original.call(instance).scale(0.5); | ||
private boolean ignorePvpFlag(boolean original) { | ||
return original || ((Object) this) instanceof MagicProjectileEntity; | ||
} | ||
} |
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
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
37 changes: 3 additions & 34 deletions
37
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,45 +1,14 @@ | ||
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 { | ||
@Shadow private Vec3 deltaMovement; | ||
private Entity self = (Entity) (Object) this; | ||
|
||
@ModifyVariable(method = "move", at = @At("HEAD"), argsOnly = true) | ||
private Vec3 modifyMotion(Vec3 value) { | ||
return value.scale(0.5); | ||
@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 | ||
} | ||
|
||
// @WrapOperation(method = "saveWithoutId", at = @At( | ||
// value = "INVOKE", | ||
// target = "Lnet/minecraft/world/entity/Entity;getDeltaMovement()Lnet/minecraft/world/phys/Vec3;" | ||
// )) | ||
// private Vec3 saveDeltaMovementField(Entity instance, Operation<Vec3> original) { | ||
// return deltaMovement; | ||
// } | ||
// | ||
// @ModifyReturnValue(method = "isNoGravity", at = @At("RETURN")) | ||
// private boolean noGrav(boolean original) { | ||
// return !(self instanceof Player); | ||
// } | ||
// | ||
// @ModifyReturnValue(method = "getDeltaMovement", at = @At("RETURN")) | ||
// private Vec3 slowMovement(Vec3 original) { | ||
// return self instanceof Player ? original : original.scale(0.5); | ||
// } | ||
// | ||
// @WrapOperation(method = "addDeltaMovement", at = @At( | ||
// value = "INVOKE", | ||
// target = "Lnet/minecraft/world/entity/Entity;getDeltaMovement()Lnet/minecraft/world/phys/Vec3;" | ||
// )) | ||
// private Vec3 painPainPain(Entity instance, Operation<Vec3> original) { | ||
// return deltaMovement; | ||
// } | ||
} |
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
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
25 changes: 0 additions & 25 deletions
25
...java/dev/cammiescorner/arcanuscontinuum/mixin/common/PersistentProjectileEntityMixin.java
This file was deleted.
Oops, something went wrong.
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
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
36 changes: 36 additions & 0 deletions
36
src/main/java/dev/cammiescorner/arcanuscontinuum/mixin/common/ServerLevelMixin.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,36 @@ | ||
package dev.cammiescorner.arcanuscontinuum.mixin.common; | ||
|
||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.core.RegistryAccess; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.util.profiling.ProfilerFiller; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.dimension.DimensionType; | ||
import net.minecraft.world.level.storage.WritableLevelData; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import java.util.function.Consumer; | ||
import java.util.function.Supplier; | ||
|
||
@Mixin(ServerLevel.class) | ||
public abstract class ServerLevelMixin extends Level { | ||
protected ServerLevelMixin(WritableLevelData levelData, ResourceKey<Level> dimension, RegistryAccess registryAccess, Holder<DimensionType> dimensionTypeRegistration, Supplier<ProfilerFiller> profiler, boolean isClientSide, boolean isDebug, long biomeZoomSeed, int maxChainedNeighborUpdates) { super(levelData, dimension, registryAccess, dimensionTypeRegistration, profiler, isClientSide, isDebug, biomeZoomSeed, maxChainedNeighborUpdates); } | ||
|
||
@WrapWithCondition(method = "method_31420", at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/server/level/ServerLevel;guardEntityTick(Ljava/util/function/Consumer;Lnet/minecraft/world/entity/Entity;)V" | ||
)) | ||
private boolean slowTime(ServerLevel instance, Consumer<?> consumer, Entity entity) { | ||
// TODO tie to being in a time dilation entity | ||
if(getGameTime() % 2 == 0) { | ||
entity.setOldPosAndRot(); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
19 changes: 0 additions & 19 deletions
19
src/main/java/dev/cammiescorner/arcanuscontinuum/mixin/common/ServerWorldMixin.java
This file was deleted.
Oops, something went wrong.
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