Skip to content

Commit

Permalink
Add RegistrationUtils#registerStellarCycle
Browse files Browse the repository at this point in the history
  • Loading branch information
FirstMegaGame4 committed Aug 19, 2023
1 parent 5bf6d0e commit 560904c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.mmodding.mmodding_lib.library.math.LinearFunction;
import com.mmodding.mmodding_lib.library.math.MathFunction;
import com.mmodding.mmodding_lib.library.utils.RegistrationUtils;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World;
Expand All @@ -26,6 +28,10 @@ private StellarCycle of(float a, float b, long fullRotationTime, RegistryKey<Wor
return new StellarCycle(MathFunction.linear(a, b), fullRotationTime, worldKey);
}

public void register(Identifier identifier) {
RegistrationUtils.registerStellarCycle(identifier, this);
}

public long getFullRotationTime() {
return this.fullRotationTime;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mmodding.mmodding_lib.library.blocks.BlockWithItem;
import com.mmodding.mmodding_lib.library.portals.squared.CustomSquaredPortal;
import com.mmodding.mmodding_lib.library.portals.squared.UnlinkedCustomSquaredPortal;
import com.mmodding.mmodding_lib.library.stellar.client.StellarCycle;
import net.minecraft.block.Block;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
Expand Down Expand Up @@ -140,4 +141,8 @@ public static void registerSquaredPortal(Identifier identifier, CustomSquaredPor
public static void registerUnlinkedSquaredPortal(Identifier identifier, UnlinkedCustomSquaredPortal squaredPortal) {
MModdingGlobalMaps.UNLINKED_CUSTOM_SQUARED_PORTALS.put(identifier, squaredPortal);
}

public static void registerStellarCycle(Identifier identifier, StellarCycle stellarCycle) {
MModdingGlobalMaps.STELLAR_CYCLES.put(identifier, stellarCycle);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ private void renderStellarObjects(MatrixStack matrices, float tickDelta, Camera
if (this.world != null && !bl) {
CameraSubmersionType cameraSubmersionType = preStep.getSubmersionType();
if (cameraSubmersionType != CameraSubmersionType.POWDER_SNOW && cameraSubmersionType != CameraSubmersionType.LAVA && !this.method_43788(preStep)) {
MModdingClientGlobalMaps.getStellarObjects().forEachOrdered(stellarObject -> stellarObject.render(matrices, this.world, tickDelta));
MModdingClientGlobalMaps.getStellarObjects().forEachOrdered(stellarObject -> {
if (stellarObject.getCycle().getWorldKey().equals(this.world.getRegistryKey())) {
stellarObject.render(matrices, this.world, tickDelta);
}
});
}
}
}
Expand Down

0 comments on commit 560904c

Please sign in to comment.