Skip to content

Commit

Permalink
Update to rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Mar 9, 2023
1 parent ac1e038 commit 0c11bad
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 35 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.19.4-pre4
yarn_mappings=1.19.4-pre4+build.1
minecraft_version=1.19.4-rc1
yarn_mappings=1.19.4-rc1+build.1
loader_version=0.14.14

#Fabric api
fabric_version=0.74.2+1.19.4

maven_group = eu.pb4

mod_version = 0.4.0-beta.4
mod_version = 0.4.0-pre.1

minecraft_version_supported = ">=1.19.4-"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import eu.pb4.polymer.virtualentity.api.ElementHolder;
import eu.pb4.polymer.virtualentity.api.attachment.ChunkAttachment;
import eu.pb4.polymer.virtualentity.api.attachment.HolderAttachment;
import eu.pb4.polymer.virtualentity.api.elements.DisplayElement;
import eu.pb4.polymer.virtualentity.api.elements.ItemDisplayElement;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
Expand Down Expand Up @@ -89,15 +88,15 @@ public void setup() {
}

public void animate() {
if (this.tick % 2 == 0) {
if (this.tick % 3 == 0) {
this.centralElement.setTransformation(new Matrix4x3f().rotateY(this.tick / 200f).rotateX(MathHelper.PI / 16).scale(2.2f));
var planet = new Matrix4x3f().rotateX(-MathHelper.PI / 16).rotateY(this.tick / 40f).translate(3.6f, 0, 0).rotateY(this.tick / 30f).rotateX(MathHelper.PI / 12).rotateZ(MathHelper.PI / 12).scale(1f);
this.planetElement.setTransformation(planet);
this.moonElement.setTransformation(planet.rotateY(this.tick / 8f).translate(1.4f, 0, 0).scale(0.42f));

this.centralElement.setInterpolationStart(this.world.getTime());
this.planetElement.setInterpolationStart(this.world.getTime());
this.moonElement.setInterpolationStart(this.world.getTime());
this.centralElement.startInterpolation();
this.planetElement.startInterpolation();
this.moonElement.startInterpolation();
this.holder.tick();
}
this.tick++;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package eu.pb4.polymertest;

import eu.pb4.polymer.core.api.entity.PolymerEntity;
import eu.pb4.polymer.core.api.entity.PolymerEntityUtils;
import eu.pb4.polymer.core.api.utils.PolymerUtils;
import eu.pb4.polymer.virtualentity.api.ElementHolder;
import eu.pb4.polymer.virtualentity.api.VirtualEntityUtils;
import eu.pb4.polymer.virtualentity.api.attachment.EntityAttachment;
import eu.pb4.polymer.virtualentity.api.elements.InteractionElement;
import eu.pb4.polymer.virtualentity.api.elements.ItemDisplayElement;
import eu.pb4.polymer.virtualentity.api.tracker.EntityTrackedData;
import eu.pb4.polymertest.mixin.EntityAccessor;
Expand Down Expand Up @@ -111,9 +109,9 @@ private void updateAnimation() {
this.previousSpeed = speed;
this.previousLimbPos = limbPos;

this.leftLeg.setInterpolationStart(this.world.getTime());
this.rightLeg.setInterpolationStart(this.world.getTime());
this.torso.setInterpolationStart(this.world.getTime());
this.leftLeg.startInterpolation();
this.rightLeg.startInterpolation();
this.torso.startInterpolation();

stack.clear();
stack.translate(0, -0.8f, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class UnrealBlockEntity extends Entity implements PolymerEntity/*, Entity
TrackedData<Vector3f> SCALE = DisplayEntityAccessor.getSCALE();
TrackedData<Quaternionf> ROTATION_LEFT = DisplayEntityAccessor.getLEFT_ROTATION();
TrackedData<Quaternionf> ROTATION_RIGHT = DisplayEntityAccessor.getRIGHT_ROTATION();
TrackedData<Long> INTER_START = DisplayEntityAccessor.getINTERPOLATION_START();
//TrackedData<Long> INTER_START = DisplayEntityAccessor.getINTERPOLATION_START();
TrackedData<Integer> INTER_DUR = DisplayEntityAccessor.getINTERPOLATION_DURATION();
TrackedData<Integer> LIGHT = DisplayEntityAccessor.getBRIGHTNESS();

Expand Down Expand Up @@ -150,7 +150,7 @@ public void modifyRawTrackedData(List<DataTracker.SerializedEntry<?>> data, Serv
data.add(DataTracker.SerializedEntry.of(ROTATION_RIGHT, this.rotationRight));
}

data.add(DataTracker.SerializedEntry.of(INTER_START, player.world.getTime()));
//data.add(DataTracker.SerializedEntry.of(INTER_START, player.world.getTime()));
data.add(DataTracker.SerializedEntry.of(INTER_DUR, 1));
data.add(DataTracker.SerializedEntry.of(TRANSLATION, this.translation));
data.add(DataTracker.SerializedEntry.of(ROTATION_LEFT, this.rotationLeft));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ static TrackedData<Quaternionf> getRIGHT_ROTATION() {
throw new UnsupportedOperationException();
}

@Accessor
static TrackedData<Long> getINTERPOLATION_START() {
throw new UnsupportedOperationException();
}

@Accessor
static TrackedData<Integer> getINTERPOLATION_DURATION() {
throw new UnsupportedOperationException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,16 @@ public void setInterpolationDuration(int interpolationDuration) {
this.dataTracker.set(DisplayTrackedData.INTERPOLATION_DURATION, interpolationDuration);
}

public long getInterpolationStart() {
return this.dataTracker.get(DisplayTrackedData.INTERPOLATION_START);
public int getStartInterpolation() {
return this.dataTracker.get(DisplayTrackedData.START_INTERPOLATION);
}

public void setInterpolationStart(long interpolationStart) {
this.dataTracker.set(DisplayTrackedData.INTERPOLATION_START, interpolationStart);
public void startInterpolation() {
this.dataTracker.setDirty(DisplayTrackedData.START_INTERPOLATION, true);
}

public void setStartInterpolation(int startInterpolation) {
this.dataTracker.set(DisplayTrackedData.START_INTERPOLATION, startInterpolation, true);
}

public DisplayEntity.BillboardMode getBillboardMode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ public interface DataTrackerLike {

@Nullable

<T> void set(TrackedData<T> key, T value);
default <T> void set(TrackedData<T> key, T value) {
set(key, value, false);
}

<T> void set(TrackedData<T> key, T value, boolean forceDirty);

<T> void setDirty(TrackedData<T> key, boolean isDirty);

boolean isDirty();

Expand All @@ -32,8 +38,13 @@ static DataTrackerLike wrap(DataTracker dataTracker) {
}

@Override
public <T> @Nullable void set(TrackedData<T> key, T value) {
dataTracker.set(key, value);
public <T> void set(TrackedData<T> key, T value, boolean forceDirty) {
dataTracker.method_49743(key, value, forceDirty);
}

@Override
public <T> void setDirty(TrackedData<T> key, boolean isDirty) {
dataTracker.method_49743(key, dataTracker.get(key), isDirty);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public final class DisplayTrackedData {
public final static TrackedData<Vector3f> SCALE = DisplayEntityAccessor.getSCALE();
public final static TrackedData<Quaternionf> LEFT_ROTATION = DisplayEntityAccessor.getLEFT_ROTATION();
public final static TrackedData<Quaternionf> RIGHT_ROTATION = DisplayEntityAccessor.getRIGHT_ROTATION();
public final static TrackedData<Long> INTERPOLATION_START = DisplayEntityAccessor.getINTERPOLATION_START();
public final static TrackedData<Integer> INTERPOLATION_DURATION = DisplayEntityAccessor.getINTERPOLATION_DURATION();
public final static TrackedData<Integer> START_INTERPOLATION = DisplayEntityAccessor.getField_43151();
public final static TrackedData<Integer> BRIGHTNESS = DisplayEntityAccessor.getBRIGHTNESS();
public final static TrackedData<Float> VIEW_RANGE = DisplayEntityAccessor.getVIEW_RANGE();
public final static TrackedData<Float> SHADOW_RADIUS = DisplayEntityAccessor.getSHADOW_RADIUS();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,24 @@ private <T> Entry<T> getEntry(TrackedData<T> data) {
}

@Override
public <T> void set(TrackedData<T> key, T value) {
public <T> void set(TrackedData<T> key, T value, boolean forceDirty) {
var entry = getEntry(key);
if (entry != null && ObjectUtils.notEqual(value, entry.get())) {
if (entry != null && (forceDirty || ObjectUtils.notEqual(value, entry.get()))) {
entry.set(value);
entry.setDirty(true);
this.dirty = true;
}
}

@Override
public <T> void setDirty(TrackedData<T> key, boolean isDirty) {
var entry = getEntry(key);
if (entry != null) {
entry.setDirty(isDirty);
this.dirty |= isDirty;
}
}

@Override
public boolean isDirty() {
return this.dirty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ static TrackedData<Quaternionf> getRIGHT_ROTATION() {
throw new UnsupportedOperationException();
}

@Accessor
static TrackedData<Long> getINTERPOLATION_START() {
throw new UnsupportedOperationException();
}

@Accessor
static TrackedData<Integer> getINTERPOLATION_DURATION() {
throw new UnsupportedOperationException();
Expand Down Expand Up @@ -78,4 +73,9 @@ static TrackedData<Integer> getGLOW_COLOR_OVERRIDE() {
static TrackedData<Byte> getBILLBOARD() {
throw new UnsupportedOperationException();
}

@Accessor
static TrackedData<Integer> getField_43151() {
throw new UnsupportedOperationException();
}
}

0 comments on commit 0c11bad

Please sign in to comment.