Skip to content
This repository was archived by the owner on Jul 18, 2023. It is now read-only.

Space stations #26

Open
wants to merge 20 commits into
base: dev/0.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ repositories {
includeGroup("dev.galacticraft")
}
}
maven("https://maven.galacticraft.net/repository/maven-snapshots/") {
name = "Galacticraft Repository"
content {
includeVersionByRegex("dev.galacticraft", ".*", ".*-SNAPSHOT")
}
}
}

dependencies {
Expand All @@ -122,7 +128,7 @@ dependencies {
modImplementation("net.fabricmc.fabric-api:fabric-api:$fabric")

modImplementation("dev.galacticraft:MachineLib:$machinelib")
// modImplementation("dev.galacticraft:dyndims:$dyndims")
modImplementation("dev.galacticraft:dyndims:$dyndims")
}

tasks.processResources {
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ mod.group=dev.galacticraft

# Minecraft and Fabric Loader
minecraft.version=1.19.2
loader.version=0.14.9
loader.version=0.14.10

# Mod Dependencies
fabric.version=0.60.0+1.19.2
fabric.version=0.64.0+1.19.2
machinelib.version=0.1.0+98a0a4f3
dyndims.version=0.3.0
dyndims.version=0.4.0-SNAPSHOT
Empty file modified gradlew
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,26 @@
* @author <a href="https://github.com/TeamGalacticraft">TeamGalacticraft</a>
*/
public interface ChunkSectionOxygenAccessor {
/**
* Returns whether the supplied position in this chunk section is breathable for entities
*
* @param x the position to test on the X-axis
* @param y the position to test on the Y-axis
* @param z the position to test on the Z-axis
* @return whether the supplied position in this chunk section is breathable for entities
*/
default boolean isBreathable(int x, int y, int z) {
throw new RuntimeException("This should be overridden by mixin!");
}

/**
* Sets the breathable state for entities for the supplied position
*
* @param x the position to test on the X-axis
* @param y the position to test on the Y-axis
* @param z the position to test on the Z-axis
* @param value whether the supplied position is breathable
*/
default void setBreathable(int x, int y, int z, boolean value) {
throw new RuntimeException("This should be overridden by mixin!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
package dev.galacticraft.api.accessor;

import dev.galacticraft.api.universe.celestialbody.CelestialBody;
import dev.galacticraft.impl.universe.celestialbody.type.SatelliteType;
import dev.galacticraft.impl.universe.position.config.SatelliteConfig;
import dev.galacticraft.impl.universe.celestialbody.type.SpaceStationType;
import dev.galacticraft.impl.universe.position.config.SpaceStationConfig;
import java.util.Map;
import net.minecraft.resources.ResourceLocation;

public interface SatelliteAccessor {
Map<ResourceLocation, CelestialBody<SatelliteConfig, SatelliteType>> getSatellites();
Map<ResourceLocation, CelestialBody<SpaceStationConfig, SpaceStationType>> getSatellites();

void addSatellite(ResourceLocation id, CelestialBody<SatelliteConfig, SatelliteType> satellite);
void addSatellite(ResourceLocation id, CelestialBody<SpaceStationConfig, SpaceStationType> satellite);

void removeSatellite(ResourceLocation id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

import dev.galacticraft.api.accessor.SatelliteAccessor;
import dev.galacticraft.api.universe.celestialbody.CelestialBody;
import dev.galacticraft.impl.universe.celestialbody.type.SatelliteType;
import dev.galacticraft.impl.universe.position.config.SatelliteConfig;
import dev.galacticraft.impl.universe.celestialbody.type.SpaceStationType;
import dev.galacticraft.impl.universe.position.config.SpaceStationConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

Expand All @@ -37,6 +37,6 @@ public interface ClientSatelliteAccessor extends SatelliteAccessor {

@FunctionalInterface
interface SatelliteListener {
void onSatelliteUpdated(CelestialBody<SatelliteConfig, SatelliteType> satellite, boolean added);
void onSatelliteUpdated(CelestialBody<?, ?> satellite, boolean added);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import com.mojang.logging.LogUtils;
import com.mojang.serialization.JsonOps;
import dev.galacticraft.api.gas.GasComposition;
import dev.galacticraft.api.satellite.SatelliteRecipe;
import dev.galacticraft.api.satellite.SpaceStationRecipe;
import dev.galacticraft.api.universe.celestialbody.CelestialBody;
import dev.galacticraft.api.universe.display.CelestialDisplay;
import dev.galacticraft.api.universe.galaxy.Galaxy;
Expand Down Expand Up @@ -218,7 +218,7 @@ public class PlanetBuilder implements CelestialBuilder {
private GasComposition atmosphere;
private float gravity;
private int accessWeight, dayTemperature, nightTemperature;
private Optional<SatelliteRecipe> satelliteRecipe;
private Optional<SpaceStationRecipe> satelliteRecipe;

PlanetBuilder(ResourceLocation key) {
this.key = key;
Expand Down Expand Up @@ -290,7 +290,7 @@ public PlanetBuilder nightTemperature(int nightTemperature) {
return this;
}

public PlanetBuilder satelliteRecipe(Optional<SatelliteRecipe> satelliteRecipe) {
public PlanetBuilder satelliteRecipe(Optional<SpaceStationRecipe> satelliteRecipe) {
this.satelliteRecipe = satelliteRecipe;
return this;
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/dev/galacticraft/api/satellite/Satellite.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public interface Satellite<C extends CelestialBodyConfig> {
* @return the ownership data of this satellite
* @see SatelliteOwnershipData
*/
SatelliteOwnershipData ownershipData(C config);
SatelliteOwnershipData ownershipData(@NotNull C config);

/**
* Returns the custom name of this satellite
* By default it is {@code <Player Name>'s satellite}
* By default it is {@code [Player Name]'s satellite}
*
* @param config the satellite configuration to be queried
* @return the custom name of this satellite
Expand All @@ -56,5 +56,5 @@ public interface Satellite<C extends CelestialBodyConfig> {
* @param text the text to set
* @param config the satellite configuration to be set
*/
void setCustomName(@NotNull Component text, C config);
void setCustomName(@NotNull Component text, @NotNull C config);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.mojang.datafixers.util.Pair;
import com.mojang.serialization.*;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import dev.galacticraft.impl.satellite.SatelliteRecipeImpl;
import dev.galacticraft.impl.satellite.SpaceStationRecipeImpl;
import it.unimi.dsi.fastutil.objects.Object2IntArrayMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import org.jetbrains.annotations.Contract;
Expand All @@ -35,7 +35,7 @@
import net.minecraft.world.Container;
import net.minecraft.world.item.crafting.Ingredient;

public interface SatelliteRecipe extends Predicate<Container> {
public interface SpaceStationRecipe extends Predicate<Container> {
Codec<Ingredient> INGREDIENT_CODEC = new Codec<>() {
@Override
public <T> DataResult<T> encode(Ingredient input, DynamicOps<T> ops, T prefix) {
Expand All @@ -48,7 +48,7 @@ public <T> DataResult<Pair<Ingredient, T>> decode(DynamicOps<T> ops, T input) {
}
};

Codec<SatelliteRecipe> CODEC = RecordCodecBuilder.create(i -> i.group(
Codec<SpaceStationRecipe> CODEC = RecordCodecBuilder.create(i -> i.group(
new Codec<Object2IntMap<Ingredient>>() {
@Override
public <T> DataResult<T> encode(Object2IntMap<Ingredient> input, DynamicOps<T> ops, T prefix) {
Expand All @@ -64,12 +64,12 @@ public <T> DataResult<Pair<Object2IntMap<Ingredient>, T>> decode(DynamicOps<T> o
mapLike.entries().forEachOrdered(ttPair -> list.put(INGREDIENT_CODEC.decode(ops, ttPair.getFirst()).get().orThrow().getFirst(), ops.getNumberValue(ttPair.getSecond()).get().orThrow().intValue()));
return DataResult.success(new Pair<>(list, input));
}
}.fieldOf("ingredients").forGetter(SatelliteRecipe::ingredients)
).apply(i, SatelliteRecipe::create));
}.fieldOf("ingredients").forGetter(SpaceStationRecipe::ingredients)
).apply(i, SpaceStationRecipe::create));

@Contract(value = "_ -> new", pure = true)
static @NotNull SatelliteRecipe create(Object2IntMap<Ingredient> list) {
return new SatelliteRecipeImpl(list);
static @NotNull SpaceStationRecipe create(Object2IntMap<Ingredient> list) {
return new SpaceStationRecipeImpl(list);
}

Object2IntMap<Ingredient> ingredients();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public interface Landable<C extends CelestialBodyConfig> extends SurfaceEnvironm
* @param config the celestial body configuration to be queried
* @return the registry key of the {@link Level} this celestial body is linked to
*/
@NotNull ResourceKey<Level> world(C config);
@NotNull ResourceKey<Level> world(@NotNull C config);

/**
* Returns the access weight required to generically reach this celestial body or a negative value if it cannot be accessed this way.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,37 @@

package dev.galacticraft.api.universe.celestialbody.satellite;

import dev.galacticraft.api.satellite.SatelliteRecipe;
import dev.galacticraft.api.satellite.SpaceStationRecipe;
import dev.galacticraft.api.universe.celestialbody.CelestialBodyConfig;
import dev.galacticraft.impl.universe.position.config.SpaceStationConfig;
import net.minecraft.core.RegistryAccess;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.Nullable;

/**
* Represents a {@link dev.galacticraft.api.universe.celestialbody.CelestialBodyType<C> celestial body type} that can potentially allow player-made objects to orbit itself.
* Moons and other natural satellites are not effected by this.
*
* @param <C> the type of configuration
*/
public interface Orbitable<C extends CelestialBodyConfig> {
/**
* Returns the {@link SatelliteRecipe stellite recipe} of this celestial body, or {@code null} if satellites should not be allowed to be created
* Returns the {@link SpaceStationRecipe stellite recipe} of this celestial body, or {@code null} if satellites should not be allowed to be created
*
* @param config the celestial body configuration to be queried
* @return the {@link SatelliteRecipe satellite recipe} of this celestial body
* @return the {@link SpaceStationRecipe satellite recipe} of this celestial body
*/
@Nullable SatelliteRecipe satelliteRecipe(C config);
@Nullable SpaceStationRecipe getSpaceStationRecipe(C config);

/**
* Callback to register client listeners (for example, {@link net.fabricmc.fabric.api.client.rendering.v1.DimensionRenderingRegistry.SkyRenderer sky renderers}) for this celestial body.
* Should only be called on the client.
*
* @param world
* @param key the {@link ResourceKey} of the satellite's dimension
* @param config the celestial body configuration
* @param spaceStationConfig
*/
void registerClientWorldHooks(RegistryAccess manager, /*Client*/Level world, ResourceKey<Level> key, C config, SpaceStationConfig spaceStationConfig);
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public record CelestialDisplay<C extends CelestialDisplayConfig, T extends Celes
public static final Codec<CelestialDisplay<?, ?>> CODEC = AddonRegistry.CELESTIAL_DISPLAY_TYPE.byNameCodec().dispatch(CelestialDisplay::type, CelestialDisplayType::codec);

@Environment(EnvType.CLIENT)
public Vector4f render(PoseStack matrices, BufferBuilder buffer, int scale, double mouseX, double mouseY, float delta, Consumer<Supplier<ShaderInstance>> shaderSetter) {
public Vector4f render(PoseStack matrices, BufferBuilder buffer, float scale, double mouseX, double mouseY, float delta, Consumer<Supplier<ShaderInstance>> shaderSetter) {
return this.type().render(matrices, buffer, scale, mouseX, mouseY, delta, shaderSetter, this.config());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public CelestialDisplayType(Codec<C> codec) {
}

@Environment(EnvType.CLIENT)
public abstract Vector4f render(PoseStack matrices, BufferBuilder buffer, int size, double mouseX, double mouseY, float delta, Consumer<Supplier<ShaderInstance>> shaderSetter, C config);
public abstract Vector4f render(PoseStack matrices, BufferBuilder buffer, float size, double mouseX, double mouseY, float delta, Consumer<Supplier<ShaderInstance>> shaderSetter, C config);

public Codec<CelestialDisplay<C, CelestialDisplayType<C>>> codec() {
return this.codec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@
*/
@ApiStatus.Internal
public interface SoundSystemAccessor {
void updateAtmosphericVolumeMultiplier(float multiplier);
default void updateAtmosphericVolumeMultiplier(float multiplier) {
throw new RuntimeException("This should not happen, you need to override this!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
@Environment(EnvType.CLIENT)
@ApiStatus.Internal
public interface ClientResearchAccessor extends ResearchAccessor {
void readChanges(FriendlyByteBuf buf);
default void readChanges(FriendlyByteBuf buf) {
throw new RuntimeException("This should not happen, you need to override this!");
}
}
Loading