Skip to content

Commit

Permalink
Merge branch '1.21.2' into 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Treetrain1 committed Jan 8, 2025
2 parents 1f46287 + 9f9bf95 commit bdbf50a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Make sure to clear this after each release
Put changelog here:

-----------------
- Removed the `loot table whacker.`
- Restored the directional Gravity API
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ dependencies {
modApi("com.moandjiezana.toml:toml4j:$toml4j_version")//?.let { include(it) }

// Jankson
relocModApi("com.github.Treetrain1:Jankson:mod-SNAPSHOT")
relocModApi("com.github.Treetrain1:Jankson:510cecf79c")

// ExJson
//relocModApi("org.exjson:xjs-data:$xjs_data_version")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
min_loader_version=0.16.9

# Mod Properties
mod_version = 1.9.10
mod_version = 1.9.11
maven_group = net.frozenblock
archives_base_name = FrozenLib

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/frozenblock/lib/gravity/api/GravityAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static List<GravityBelt<?>> getAllBelts(Level level) {
}

public static Vec3 calculateGravity(ResourceKey<Level> dimension, double y) {
GravityContext context = new GravityContext(dimension, y, null);
GravityContext context = new GravityContext(dimension, y, null, null);
MODIFICATIONS.invoker().modifyGravity(context);
return context.gravity;
}
Expand All @@ -82,7 +82,7 @@ public static Vec3 calculateGravity(Level level, double y) {
public static Vec3 calculateGravity(Entity entity) {
ResourceKey<Level> dimension = entity.level().dimension();
double y = entity.getY();
GravityContext context = new GravityContext(dimension, y, entity);
GravityContext context = new GravityContext(dimension, y, entity, entity.getInBlockState());
MODIFICATIONS.invoker().modifyGravity(context);
return context.gravity;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable;

Expand All @@ -37,14 +38,18 @@ public class GravityContext {
@Nullable
public final Entity entity;

public GravityContext(ResourceKey<Level> dimension, double y, @Nullable Entity entity) {
this(dimension, y, GravityAPI.DEFAULT_GRAVITY, entity);
@Nullable
public final BlockState state;

public GravityContext(ResourceKey<Level> dimension, double y, @Nullable Entity entity, @Nullable BlockState state) {
this(dimension, y, GravityAPI.DEFAULT_GRAVITY, entity, state);
}

public GravityContext(ResourceKey<Level> dimension, double y, Vec3 gravity, @Nullable Entity entity) {
public GravityContext(ResourceKey<Level> dimension, double y, Vec3 gravity, @Nullable Entity entity, @Nullable BlockState state) {
this.dimension = dimension;
this.y = y;
this.gravity = gravity;
this.entity = entity;
this.state = state;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@

package net.frozenblock.lib.testmod;

import com.mojang.datafixers.schemas.Schema;
import java.util.List;
import net.fabricmc.api.ModInitializer;
//import net.fabricmc.frozenblock.datafixer.api.FabricDataFixerBuilder;
//import net.fabricmc.frozenblock.datafixer.api.FabricDataFixes;
//import net.fabricmc.frozenblock.datafixer.api.SimpleFixes;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.frozenblock.lib.FrozenSharedConstants;
import net.frozenblock.lib.advancement.api.AdvancementAPI;
import net.frozenblock.lib.advancement.api.AdvancementEvents;
import net.frozenblock.lib.block.api.tick.BlockScheduledTicks;
Expand All @@ -42,7 +40,7 @@
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.datafix.schemas.NamespacedSchema;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.biome.Biomes;
import net.minecraft.world.level.block.Blocks;
Expand All @@ -68,7 +66,9 @@ public void onInitialize() {
Blocks.BEDROCK.defaultBlockState(), 3));

GravityAPI.MODIFICATIONS.register((ctx) -> {
ctx.gravity = new Vec3(0.05, 0.8, 0.05);
if (ctx.y < 300 && ctx.entity instanceof Player) {
ctx.gravity = new Vec3(0.05, 0.8, 0.05);
}
});

GravityAPI.register(Level.OVERWORLD, new GravityBelt<>(300, 319, true, true, new AbsoluteGravityFunction(new Vec3(0.0, 0.1, 0.0))));
Expand Down

0 comments on commit bdbf50a

Please sign in to comment.