-
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.
time dilation entity made but not properly done yet
- Loading branch information
1 parent
4f5c472
commit e745a4f
Showing
4 changed files
with
100 additions
and
11 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
...dev/cammiescorner/arcanuscontinuum/client/models/entity/magic/TimeDilationFieldModel.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,63 @@ | ||
package dev.cammiescorner.arcanuscontinuum.client.models.entity.magic; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.blaze3d.vertex.VertexConsumer; | ||
import dev.cammiescorner.arcanuscontinuum.common.entities.magic.TimeDilationField; | ||
import net.minecraft.client.model.EntityModel; | ||
import net.minecraft.client.model.geom.ModelLayerLocation; | ||
import net.minecraft.client.model.geom.ModelPart; | ||
import net.minecraft.client.model.geom.PartPose; | ||
import net.minecraft.client.model.geom.builders.*; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
public class TimeDilationFieldModel<T extends TimeDilationField> extends EntityModel<T> { | ||
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation("modid", "timedilationfieldmodel"), "main"); | ||
private final ModelPart root; | ||
private final ModelPart xPlaneRing; | ||
private final ModelPart xClockHand; | ||
private final ModelPart yPlaneRing; | ||
private final ModelPart yClockHand; | ||
private final ModelPart zPlaneRing; | ||
private final ModelPart zClockHand; | ||
|
||
public TimeDilationFieldModel(ModelPart root) { | ||
this.root = root.getChild("root"); | ||
this.xPlaneRing = this.root.getChild("xPlaneRing"); | ||
this.xClockHand = this.xPlaneRing.getChild("xClockHand"); | ||
this.yPlaneRing = this.root.getChild("yPlaneRing"); | ||
this.yClockHand = this.yPlaneRing.getChild("yClockHand"); | ||
this.zPlaneRing = this.root.getChild("zPlaneRing"); | ||
this.zClockHand = this.zPlaneRing.getChild("zClockHand"); | ||
} | ||
|
||
public static LayerDefinition createBodyLayer() { | ||
MeshDefinition meshdefinition = new MeshDefinition(); | ||
PartDefinition partdefinition = meshdefinition.getRoot(); | ||
|
||
PartDefinition root = partdefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, 0.0F)); | ||
|
||
PartDefinition xPlaneRing = root.addOrReplaceChild("xPlaneRing", CubeListBuilder.create().texOffs(0, -55).addBox(0.0F, -27.5F, -27.5F, 0.0F, 55.0F, 55.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); | ||
|
||
PartDefinition xClockHand = xPlaneRing.addOrReplaceChild("xClockHand", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, -27.5F, -27.5F, 0.0F, 55.0F, 55.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); | ||
|
||
PartDefinition yPlaneRing = root.addOrReplaceChild("yPlaneRing", CubeListBuilder.create().texOffs(-55, 0).addBox(-27.5F, 0.0F, -27.5F, 55.0F, 0.0F, 55.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); | ||
|
||
PartDefinition yClockHand = yPlaneRing.addOrReplaceChild("yClockHand", CubeListBuilder.create().texOffs(-55, 55).addBox(-27.5F, 0.0F, -27.5F, 55.0F, 0.0F, 55.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); | ||
|
||
PartDefinition zPlaneRing = root.addOrReplaceChild("zPlaneRing", CubeListBuilder.create().texOffs(0, 0).addBox(-27.5F, -27.5F, 0.0F, 55.0F, 55.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); | ||
|
||
PartDefinition zClockHand = zPlaneRing.addOrReplaceChild("zClockHand", CubeListBuilder.create().texOffs(0, 55).addBox(-27.5F, -27.5F, 0.0F, 55.0F, 55.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); | ||
|
||
return LayerDefinition.create(meshdefinition, 110, 110); | ||
} | ||
|
||
@Override | ||
public void setupAnim(TimeDilationField entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { | ||
|
||
} | ||
|
||
@Override | ||
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { | ||
root.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...main/java/dev/cammiescorner/arcanuscontinuum/common/entities/magic/TimeDilationField.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,27 @@ | ||
package dev.cammiescorner.arcanuscontinuum.common.entities.magic; | ||
|
||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.level.Level; | ||
|
||
public class TimeDilationField extends Entity { | ||
public TimeDilationField(EntityType<?> entityType, Level level) { | ||
super(entityType, level); | ||
} | ||
|
||
@Override | ||
protected void defineSynchedData() { | ||
|
||
} | ||
|
||
@Override | ||
protected void readAdditionalSaveData(CompoundTag compound) { | ||
|
||
} | ||
|
||
@Override | ||
protected void addAdditionalSaveData(CompoundTag compound) { | ||
|
||
} | ||
} |
21 changes: 10 additions & 11 deletions
21
src/main/java/dev/cammiescorner/arcanuscontinuum/mixin/client/AbstractClientPlayerMixin.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,31 +1,30 @@ | ||
package dev.cammiescorner.arcanuscontinuum.mixin.client; | ||
|
||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; | ||
import com.mojang.authlib.GameProfile; | ||
import net.minecraft.client.player.AbstractClientPlayer; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.level.Level; | ||
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.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(AbstractClientPlayer.class) | ||
public abstract class AbstractClientPlayerMixin extends Player { | ||
@Shadow protected Vec3 deltaMovementOnPreviousTick; | ||
|
||
public AbstractClientPlayerMixin(Level level, BlockPos pos, float yRot, GameProfile gameProfile) { super(level, pos, yRot, gameProfile); } | ||
|
||
@Inject(method = "tick", at = @At("HEAD"), cancellable = true) | ||
private void timeSlow(CallbackInfo info) { | ||
// TODO figure out how to smooth this | ||
@WrapWithCondition(method = "tick", at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/world/entity/player/Player;tick()V" | ||
)) | ||
private boolean timeSlow(Player instance) { | ||
// TODO figure out how to smooth this & tie it to being in a time dilation field | ||
if(level().getGameTime() % 2 == 0) { | ||
deltaMovementOnPreviousTick = getDeltaMovement(); | ||
setOldPosAndRot(); | ||
tickCount++; | ||
info.cancel(); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
Binary file added
BIN
+610 Bytes
...resources/assets/arcanuscontinuum/textures/entity/magic/time_dilation_field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.