) this.entries.add(resourceKey, object);
39 | }
40 |
41 | @Override
42 | public @NotNull HolderGetter lookup(ResourceKey extends Registry extends S>> resourceKey) {
43 | return this.registries.lookupOrThrow(resourceKey);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/accessor/AdvancementRewardsAccessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.internal.accessor;
24 |
25 | import net.minecraft.resources.ResourceLocation;
26 | import org.jetbrains.annotations.NotNull;
27 | import org.jetbrains.annotations.Nullable;
28 |
29 | public interface AdvancementRewardsAccessor {
30 | void setRocketPartRewards(@NotNull ResourceLocation @Nullable [] parts);
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/accessor/ChunkOxygenAccessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.internal.accessor;
24 |
25 | public interface ChunkOxygenAccessor {
26 | /**
27 | * Returns whether the supplied position in the chunk is breathable for entities
28 | *
29 | * @param x the position to test on the X-axis, normalized from 0 to 15
30 | * @param y the position to test on the Y-axis, must be within world height
31 | * @param z the position to test on the Z-axis, normalized from 0 to 15
32 | * @return whether the supplied position in the chunk is breathable for entities
33 | */
34 | boolean galacticraft$isInverted(int x, int y, int z);
35 |
36 | /**
37 | * Sets the breathable state for entities for the supplied position
38 | *
39 | * @param x the position to test on the X-axis, normalized from 0 to 15
40 | * @param y the position to test on the Y-axis, must be within world height
41 | * @param z the position to test on the Z-axis, normalized from 0 to 15
42 | * @param inverted whether the supplied position is breathable
43 | */
44 | void galacticraft$setInverted(int x, int y, int z, boolean inverted);
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/accessor/ChunkOxygenSyncer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.internal.accessor;
24 |
25 | import net.minecraft.network.FriendlyByteBuf;
26 | import org.jetbrains.annotations.NotNull;
27 | import org.jetbrains.annotations.Nullable;
28 |
29 | public interface ChunkOxygenSyncer {
30 | default @Nullable FriendlyByteBuf galacticraft$syncOxygenPacketsToClient() {
31 | return null;
32 | }
33 |
34 | default void galacticraft$readOxygenUpdate(@NotNull FriendlyByteBuf buf) {
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/accessor/ChunkSectionOxygenAccessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.internal.accessor;
24 |
25 | import net.minecraft.network.FriendlyByteBuf;
26 | import org.jetbrains.annotations.ApiStatus;
27 | import org.jetbrains.annotations.NotNull;
28 | import org.jetbrains.annotations.Nullable;
29 |
30 | import java.util.BitSet;
31 |
32 | /**
33 | * @author TeamGalacticraft
34 | */
35 | @ApiStatus.Internal
36 | public interface ChunkSectionOxygenAccessor {
37 | boolean galacticraft$isInverted(int x, int y, int z);
38 |
39 | void galacticraft$setInverted(int x, int y, int z, boolean inverted);
40 |
41 | @Nullable BitSet galacticraft$inversionBits();
42 |
43 | void galacticraft$setInversionBits(@Nullable BitSet set);
44 |
45 | short galacticraft$modifiedBlocks();
46 |
47 | void galacticraft$setModifiedBlocks(short amount);
48 |
49 | void galacticraft$writeOxygenPacket(@NotNull FriendlyByteBuf buf);
50 |
51 | void galacticraft$readOxygenPacket(@NotNull FriendlyByteBuf buf);
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/accessor/InternalLevelOxygenAccessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.internal.accessor;
24 |
25 | import org.jetbrains.annotations.ApiStatus;
26 |
27 | @ApiStatus.Internal
28 | public interface InternalLevelOxygenAccessor {
29 | boolean getDefaultBreathable();
30 |
31 | void setDefaultBreathable(boolean breathable);
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/accessor/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | @ApiStatus.Internal
24 | package dev.galacticraft.impl.internal.accessor;
25 |
26 | import org.jetbrains.annotations.ApiStatus;
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/mixin/client/ParticleAccessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.internal.mixin.client;
24 |
25 | import net.minecraft.client.particle.Particle;
26 | import org.spongepowered.asm.mixin.Mixin;
27 | import org.spongepowered.asm.mixin.gen.Accessor;
28 |
29 | @Mixin(Particle.class)
30 | public interface ParticleAccessor {
31 | @Accessor("gravity")
32 | float getGravityStrength();
33 |
34 | @Accessor("gravity")
35 | void setGravityStrength(float gravityStrength);
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/mixin/client/ParticleManagerMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.internal.mixin.client;
24 |
25 | import dev.galacticraft.api.universe.celestialbody.CelestialBody;
26 | import net.fabricmc.api.EnvType;
27 | import net.fabricmc.api.Environment;
28 | import net.minecraft.client.multiplayer.ClientLevel;
29 | import net.minecraft.client.particle.Particle;
30 | import net.minecraft.client.particle.ParticleEngine;
31 | import org.spongepowered.asm.mixin.Mixin;
32 | import org.spongepowered.asm.mixin.Shadow;
33 | import org.spongepowered.asm.mixin.injection.At;
34 | import org.spongepowered.asm.mixin.injection.Inject;
35 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
36 |
37 | @Mixin(ParticleEngine.class)
38 | @Environment(EnvType.CLIENT)
39 | public abstract class ParticleManagerMixin {
40 | @Shadow
41 | protected ClientLevel level;
42 |
43 | @Inject(method = "add(Lnet/minecraft/client/particle/Particle;)V", at = @At("RETURN"))
44 | protected void galacticraft_overrideGravity(Particle particle, CallbackInfo ci) {
45 | CelestialBody.getByDimension(this.level).ifPresent(celestialBodyType -> ((ParticleAccessor) particle).setGravityStrength(((ParticleAccessor) particle).getGravityStrength() * celestialBodyType.gravity()));
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/mixin/client/SoundManagerAccessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.internal.mixin.client;
24 |
25 | import net.fabricmc.api.EnvType;
26 | import net.fabricmc.api.Environment;
27 | import net.minecraft.client.sounds.SoundEngine;
28 | import net.minecraft.client.sounds.SoundManager;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.gen.Accessor;
31 |
32 | @Mixin(SoundManager.class)
33 | @Environment(EnvType.CLIENT)
34 | public interface SoundManagerAccessor {
35 | @Accessor("soundEngine")
36 | SoundEngine getSoundSystem();
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/mixin/client/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | /**
24 | * Mixins for Galacticraft-API
25 | *
26 | * Client-sided mixins for Galacticraft-API
27 | */
28 | @ApiStatus.Internal
29 | package dev.galacticraft.impl.internal.mixin.client;
30 |
31 | import org.jetbrains.annotations.ApiStatus;
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/mixin/gravity/EntityGravityMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.internal.mixin.gravity;
24 |
25 | import dev.galacticraft.api.universe.celestialbody.CelestialBody;
26 | import net.minecraft.world.entity.Entity;
27 | import net.minecraft.world.entity.item.ItemEntity;
28 | import net.minecraft.world.entity.item.PrimedTnt;
29 | import net.minecraft.world.entity.vehicle.AbstractMinecart;
30 | import org.spongepowered.asm.mixin.Mixin;
31 | import org.spongepowered.asm.mixin.injection.Constant;
32 | import org.spongepowered.asm.mixin.injection.ModifyConstant;
33 |
34 | @Mixin({ItemEntity.class, PrimedTnt.class, AbstractMinecart.class})
35 | public abstract class EntityGravityMixin {
36 | @ModifyConstant(method = "tick", constant = @Constant(doubleValue = -0.04D))
37 | private double galacticraft_changeEntityGravity(double defaultValue) {
38 | return CelestialBody.getByDimension(((Entity) (Object) this).level()).map(celestialBody -> celestialBody.gravity() / 1.75D * defaultValue).orElse(defaultValue);
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/mixin/oxygen/EmptyLevelChunkMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.internal.mixin.oxygen;
24 |
25 | import dev.galacticraft.impl.internal.accessor.ChunkOxygenAccessor;
26 | import dev.galacticraft.impl.internal.accessor.ChunkOxygenSyncer;
27 | import net.minecraft.world.level.chunk.EmptyLevelChunk;
28 | import org.spongepowered.asm.mixin.Mixin;
29 |
30 | /**
31 | * @author TeamGalacticraft
32 | */
33 | @Mixin(EmptyLevelChunk.class)
34 | public abstract class EmptyLevelChunkMixin implements ChunkOxygenSyncer, ChunkOxygenAccessor {
35 | @Override
36 | public boolean galacticraft$isInverted(int x, int y, int z) {
37 | return false;
38 | }
39 |
40 | @Override
41 | public void galacticraft$setInverted(int x, int y, int z, boolean inverted) {
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/mixin/oxygen/ImposterProtoChunkMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.internal.mixin.oxygen;
24 |
25 | import dev.galacticraft.impl.internal.accessor.ChunkOxygenAccessor;
26 | import net.minecraft.world.level.chunk.ImposterProtoChunk;
27 | import net.minecraft.world.level.chunk.LevelChunk;
28 | import org.spongepowered.asm.mixin.Final;
29 | import org.spongepowered.asm.mixin.Mixin;
30 | import org.spongepowered.asm.mixin.Shadow;
31 |
32 | @Mixin(ImposterProtoChunk.class)
33 | public abstract class ImposterProtoChunkMixin implements ChunkOxygenAccessor {
34 | @Shadow @Final private boolean allowWrites;
35 | @Shadow @Final private LevelChunk wrapped;
36 |
37 | @Override
38 | public boolean galacticraft$isInverted(int x, int y, int z) {
39 | return ((ChunkOxygenAccessor)this.wrapped).galacticraft$isInverted(x, y, z);
40 | }
41 |
42 | @Override
43 | public void galacticraft$setInverted(int x, int y, int z, boolean inverted) {
44 | if (this.allowWrites) {
45 | ((ChunkOxygenAccessor)this.wrapped).galacticraft$setInverted(x, y, z, inverted);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/mixin/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | /**
24 | * Mixins for Galacticraft-API
25 | */
26 | @ApiStatus.Internal
27 | package dev.galacticraft.impl.internal.mixin;
28 |
29 | import org.jetbrains.annotations.ApiStatus;
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/internal/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | /**
24 | * Classes to make the Addon API run as an independent mod.
25 | * Includes ModInitializers and Mixins for the API.
26 | */
27 | @ApiStatus.Internal
28 | package dev.galacticraft.impl.internal;
29 |
30 | import org.jetbrains.annotations.ApiStatus;
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/RocketBodyImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part;
24 |
25 | import dev.galacticraft.api.rocket.part.RocketBody;
26 | import dev.galacticraft.api.rocket.part.config.RocketBodyConfig;
27 | import dev.galacticraft.api.rocket.part.type.RocketBodyType;
28 | import dev.galacticraft.impl.rocket.part.config.DefaultRocketBodyConfig;
29 | import dev.galacticraft.impl.rocket.part.type.InvalidRocketBodyType;
30 | import dev.galacticraft.impl.universe.BuiltinObjects;
31 | import net.minecraft.data.worldgen.BootstapContext;
32 | import org.jetbrains.annotations.ApiStatus;
33 | import org.jetbrains.annotations.NotNull;
34 |
35 | public record RocketBodyImpl>(@NotNull C config, @NotNull T type) implements RocketBody {
36 | @ApiStatus.Internal
37 | public static void bootstrapRegistries(BootstapContext> context) {
38 | context.register(BuiltinObjects.INVALID_ROCKET_BODY, RocketBody.create(DefaultRocketBodyConfig.INSTANCE, InvalidRocketBodyType.INSTANCE));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/RocketBoosterImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part;
24 |
25 | import dev.galacticraft.api.rocket.part.RocketBooster;
26 | import dev.galacticraft.api.rocket.part.config.RocketBoosterConfig;
27 | import dev.galacticraft.api.rocket.part.type.RocketBoosterType;
28 | import dev.galacticraft.impl.rocket.part.config.DefaultRocketBoosterConfig;
29 | import dev.galacticraft.impl.rocket.part.type.InvalidRocketBoosterType;
30 | import dev.galacticraft.impl.universe.BuiltinObjects;
31 | import net.minecraft.data.worldgen.BootstapContext;
32 | import org.jetbrains.annotations.ApiStatus;
33 | import org.jetbrains.annotations.NotNull;
34 |
35 | public record RocketBoosterImpl>(@NotNull C config, @NotNull T type) implements RocketBooster {
36 | @ApiStatus.Internal
37 | public static void bootstrapRegistries(BootstapContext> context) {
38 | context.register(BuiltinObjects.INVALID_ROCKET_BOOSTER, RocketBooster.create(DefaultRocketBoosterConfig.INSTANCE, InvalidRocketBoosterType.INSTANCE));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/RocketBottomImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part;
24 |
25 | import dev.galacticraft.api.rocket.part.RocketBottom;
26 | import dev.galacticraft.api.rocket.part.config.RocketBottomConfig;
27 | import dev.galacticraft.api.rocket.part.type.RocketBottomType;
28 | import dev.galacticraft.impl.rocket.part.config.DefaultRocketBottomConfig;
29 | import dev.galacticraft.impl.rocket.part.type.InvalidRocketBottomType;
30 | import dev.galacticraft.impl.universe.BuiltinObjects;
31 | import net.minecraft.data.worldgen.BootstapContext;
32 | import org.jetbrains.annotations.ApiStatus;
33 | import org.jetbrains.annotations.NotNull;
34 |
35 | public record RocketBottomImpl>(@NotNull C config, @NotNull T type) implements RocketBottom {
36 | @ApiStatus.Internal
37 | public static void bootstrapRegistries(BootstapContext> context) {
38 | context.register(BuiltinObjects.INVALID_ROCKET_BOTTOM, RocketBottom.create(DefaultRocketBottomConfig.INSTANCE, InvalidRocketBottomType.INSTANCE));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/RocketConeImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part;
24 |
25 | import dev.galacticraft.api.rocket.part.RocketCone;
26 | import dev.galacticraft.api.rocket.part.config.RocketConeConfig;
27 | import dev.galacticraft.api.rocket.part.type.RocketConeType;
28 | import dev.galacticraft.impl.rocket.part.config.DefaultRocketConeConfig;
29 | import dev.galacticraft.impl.rocket.part.type.InvalidRocketConeType;
30 | import dev.galacticraft.impl.universe.BuiltinObjects;
31 | import net.minecraft.data.worldgen.BootstapContext;
32 | import org.jetbrains.annotations.ApiStatus;
33 | import org.jetbrains.annotations.NotNull;
34 |
35 | public record RocketConeImpl>(@NotNull C config, @NotNull T type) implements RocketCone {
36 | @ApiStatus.Internal
37 | public static void bootstrapRegistries(BootstapContext> context) {
38 | context.register(BuiltinObjects.INVALID_ROCKET_CONE, RocketCone.create(DefaultRocketConeConfig.INSTANCE, InvalidRocketConeType.INSTANCE));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/RocketFinImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part;
24 |
25 | import dev.galacticraft.api.rocket.part.RocketFin;
26 | import dev.galacticraft.api.rocket.part.config.RocketFinConfig;
27 | import dev.galacticraft.api.rocket.part.type.RocketFinType;
28 | import dev.galacticraft.impl.rocket.part.config.DefaultRocketFinConfig;
29 | import dev.galacticraft.impl.rocket.part.type.InvalidRocketFinType;
30 | import dev.galacticraft.impl.universe.BuiltinObjects;
31 | import net.minecraft.data.worldgen.BootstapContext;
32 | import org.jetbrains.annotations.ApiStatus;
33 | import org.jetbrains.annotations.NotNull;
34 |
35 | public record RocketFinImpl>(@NotNull C config, @NotNull T type) implements RocketFin {
36 | @ApiStatus.Internal
37 | public static void bootstrapRegistries(BootstapContext> context) {
38 | context.register(BuiltinObjects.INVALID_ROCKET_FIN, RocketFin.create(DefaultRocketFinConfig.INSTANCE, InvalidRocketFinType.INSTANCE));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/RocketUpgradeImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part;
24 |
25 | import dev.galacticraft.api.rocket.part.RocketUpgrade;
26 | import dev.galacticraft.api.rocket.part.config.RocketUpgradeConfig;
27 | import dev.galacticraft.api.rocket.part.type.RocketUpgradeType;
28 | import dev.galacticraft.impl.rocket.part.config.DefaultRocketUpgradeConfig;
29 | import dev.galacticraft.impl.rocket.part.type.InvalidRocketUpgradeType;
30 | import dev.galacticraft.impl.universe.BuiltinObjects;
31 | import net.minecraft.data.worldgen.BootstapContext;
32 | import org.jetbrains.annotations.ApiStatus;
33 | import org.jetbrains.annotations.NotNull;
34 |
35 | public record RocketUpgradeImpl>(@NotNull C config, @NotNull T type) implements RocketUpgrade {
36 | @ApiStatus.Internal
37 | public static void bootstrapRegistries(BootstapContext> context) {
38 | context.register(BuiltinObjects.INVALID_ROCKET_UPGRADE, RocketUpgrade.create(DefaultRocketUpgradeConfig.INSTANCE, InvalidRocketUpgradeType.INSTANCE));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/config/BasicRocketBodyConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import com.mojang.serialization.codecs.RecordCodecBuilder;
27 | import dev.galacticraft.api.rocket.part.config.RocketBodyConfig;
28 | import dev.galacticraft.api.rocket.travelpredicate.ConfiguredTravelPredicate;
29 |
30 | public record BasicRocketBodyConfig(ConfiguredTravelPredicate, ?> predicate, int maxPassengers, int upgradeCapacity) implements RocketBodyConfig {
31 | public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group(
32 | ConfiguredTravelPredicate.DIRECT_CODEC.fieldOf("predicate").forGetter(BasicRocketBodyConfig::predicate),
33 | Codec.INT.fieldOf("max_passengers").forGetter(BasicRocketBodyConfig::maxPassengers),
34 | Codec.INT.fieldOf("upgrade_capacity").forGetter(BasicRocketBodyConfig::upgradeCapacity)
35 | ).apply(instance, BasicRocketBodyConfig::new));
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/config/BasicRocketBoosterConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import com.mojang.serialization.codecs.RecordCodecBuilder;
27 | import dev.galacticraft.api.rocket.part.config.RocketBoosterConfig;
28 | import dev.galacticraft.api.rocket.travelpredicate.ConfiguredTravelPredicate;
29 |
30 | public record BasicRocketBoosterConfig(ConfiguredTravelPredicate, ?> predicate, double maxVelocity, double acceleration, long fuelUsage) implements RocketBoosterConfig {
31 | public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group(
32 | ConfiguredTravelPredicate.DIRECT_CODEC.fieldOf("predicate").forGetter(BasicRocketBoosterConfig::predicate),
33 | Codec.DOUBLE.fieldOf("max_velocity").forGetter(BasicRocketBoosterConfig::maxVelocity),
34 | Codec.DOUBLE.fieldOf("acceleration").forGetter(BasicRocketBoosterConfig::acceleration),
35 | Codec.LONG.fieldOf("fuel_usage").forGetter(BasicRocketBoosterConfig::fuelUsage)
36 | ).apply(instance, BasicRocketBoosterConfig::new));
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/config/BasicRocketBottomConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import com.mojang.serialization.codecs.RecordCodecBuilder;
27 | import dev.galacticraft.api.rocket.part.config.RocketBottomConfig;
28 | import dev.galacticraft.api.rocket.travelpredicate.ConfiguredTravelPredicate;
29 |
30 | public record BasicRocketBottomConfig(ConfiguredTravelPredicate, ?> predicate, long fuelCapacity) implements RocketBottomConfig {
31 | public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group(
32 | ConfiguredTravelPredicate.DIRECT_CODEC.fieldOf("predicate").forGetter(BasicRocketBottomConfig::predicate),
33 | Codec.LONG.fieldOf("fuel_capacity").forGetter(BasicRocketBottomConfig::fuelCapacity)
34 | ).apply(instance, BasicRocketBottomConfig::new));
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/config/BasicRocketConeConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.part.config.RocketConeConfig;
27 | import dev.galacticraft.api.rocket.travelpredicate.ConfiguredTravelPredicate;
28 |
29 | public record BasicRocketConeConfig(ConfiguredTravelPredicate, ?> predicate) implements RocketConeConfig {
30 | public static final Codec CODEC = ConfiguredTravelPredicate.DIRECT_CODEC.xmap(BasicRocketConeConfig::new, BasicRocketConeConfig::predicate);
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/config/BasicRocketFinConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import com.mojang.serialization.codecs.RecordCodecBuilder;
27 | import dev.galacticraft.api.rocket.part.config.RocketFinConfig;
28 | import dev.galacticraft.api.rocket.travelpredicate.ConfiguredTravelPredicate;
29 |
30 | public record BasicRocketFinConfig(ConfiguredTravelPredicate, ?> predicate, boolean canManeuver) implements RocketFinConfig {
31 | public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group(
32 | ConfiguredTravelPredicate.DIRECT_CODEC.fieldOf("predicate").forGetter(BasicRocketFinConfig::predicate),
33 | Codec.BOOL.fieldOf("can_maneuver").forGetter(BasicRocketFinConfig::canManeuver)
34 | ).apply(instance, BasicRocketFinConfig::new));
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/config/DefaultRocketBodyConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.part.config.RocketBodyConfig;
27 |
28 | public final class DefaultRocketBodyConfig implements RocketBodyConfig {
29 | public static final DefaultRocketBodyConfig INSTANCE = new DefaultRocketBodyConfig();
30 | public static final Codec CODEC = Codec.unit(INSTANCE);
31 |
32 | private DefaultRocketBodyConfig() {
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/config/DefaultRocketBoosterConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.part.config.RocketBoosterConfig;
27 |
28 | public final class DefaultRocketBoosterConfig implements RocketBoosterConfig {
29 | public static final DefaultRocketBoosterConfig INSTANCE = new DefaultRocketBoosterConfig();
30 | public static final Codec CODEC = Codec.unit(INSTANCE);
31 |
32 | private DefaultRocketBoosterConfig() {
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/config/DefaultRocketBottomConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.part.config.RocketBottomConfig;
27 |
28 | public final class DefaultRocketBottomConfig implements RocketBottomConfig {
29 | public static final DefaultRocketBottomConfig INSTANCE = new DefaultRocketBottomConfig();
30 | public static final Codec CODEC = Codec.unit(INSTANCE);
31 |
32 | private DefaultRocketBottomConfig() {
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/config/DefaultRocketConeConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.part.config.RocketConeConfig;
27 |
28 | public final class DefaultRocketConeConfig implements RocketConeConfig {
29 | public static final DefaultRocketConeConfig INSTANCE = new DefaultRocketConeConfig();
30 | public static final Codec CODEC = Codec.unit(INSTANCE);
31 |
32 | private DefaultRocketConeConfig() {
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/config/DefaultRocketFinConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.part.config.RocketFinConfig;
27 |
28 | public final class DefaultRocketFinConfig implements RocketFinConfig {
29 | public static final DefaultRocketFinConfig INSTANCE = new DefaultRocketFinConfig();
30 | public static final Codec CODEC = Codec.unit(INSTANCE);
31 |
32 | private DefaultRocketFinConfig() {
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/config/DefaultRocketUpgradeConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.part.config.RocketUpgradeConfig;
27 |
28 | public final class DefaultRocketUpgradeConfig implements RocketUpgradeConfig {
29 | public static final DefaultRocketUpgradeConfig INSTANCE = new DefaultRocketUpgradeConfig();
30 | public static final Codec CODEC = Codec.unit(INSTANCE);
31 |
32 | private DefaultRocketUpgradeConfig() {
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/type/BasicRocketConeType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.type;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.entity.Rocket;
27 | import dev.galacticraft.api.rocket.part.type.RocketConeType;
28 | import dev.galacticraft.api.rocket.travelpredicate.ConfiguredTravelPredicate;
29 | import dev.galacticraft.impl.rocket.part.config.BasicRocketConeConfig;
30 | import dev.galacticraft.impl.rocket.travelpredicate.type.DefaultTravelPredicateType;
31 | import org.jetbrains.annotations.NotNull;
32 |
33 | public final class BasicRocketConeType extends RocketConeType {
34 | public static final BasicRocketConeType INSTANCE = new BasicRocketConeType(BasicRocketConeConfig.CODEC);
35 |
36 | private BasicRocketConeType(@NotNull Codec configCodec) {
37 | super(configCodec);
38 | }
39 |
40 | @Override
41 | public void tick(@NotNull Rocket rocket, @NotNull BasicRocketConeConfig config) {
42 | }
43 |
44 | @Override
45 | public @NotNull ConfiguredTravelPredicate, ?> travelPredicate(@NotNull BasicRocketConeConfig config) {
46 | return config.predicate();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/part/type/InvalidRocketConeType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.part.type;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.entity.Rocket;
27 | import dev.galacticraft.api.rocket.part.type.RocketConeType;
28 | import dev.galacticraft.api.rocket.travelpredicate.ConfiguredTravelPredicate;
29 | import dev.galacticraft.impl.rocket.part.config.DefaultRocketConeConfig;
30 | import dev.galacticraft.impl.rocket.travelpredicate.type.DefaultTravelPredicateType;
31 | import org.jetbrains.annotations.NotNull;
32 |
33 | public final class InvalidRocketConeType extends RocketConeType {
34 | public static final InvalidRocketConeType INSTANCE = new InvalidRocketConeType(DefaultRocketConeConfig.CODEC);
35 |
36 | private InvalidRocketConeType(@NotNull Codec configCodec) {
37 | super(configCodec);
38 | }
39 |
40 | @Override
41 | public void tick(@NotNull Rocket rocket, @NotNull DefaultRocketConeConfig config) {
42 | }
43 |
44 | @Override
45 | public @NotNull ConfiguredTravelPredicate, ?> travelPredicate(@NotNull DefaultRocketConeConfig config) {
46 | return DefaultTravelPredicateType.CONFIGURED;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/recipe/RocketPartRecipeImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.recipe;
24 |
25 | import dev.galacticraft.api.rocket.part.RocketPart;
26 | import dev.galacticraft.api.rocket.recipe.RocketPartRecipe;
27 | import dev.galacticraft.api.rocket.recipe.RocketPartRecipeSlot;
28 | import dev.galacticraft.api.rocket.recipe.config.RocketPartRecipeConfig;
29 | import dev.galacticraft.api.rocket.recipe.type.RocketPartRecipeType;
30 | import net.minecraft.resources.ResourceKey;
31 | import org.jetbrains.annotations.NotNull;
32 |
33 | import java.util.List;
34 |
35 | public record RocketPartRecipeImpl>(T type, C config) implements RocketPartRecipe {
36 | @Override
37 | public int width() {
38 | return this.type().width(this.config);
39 | }
40 |
41 | @Override
42 | public int height() {
43 | return this.type().height(this.config);
44 | }
45 |
46 | @Override
47 | public @NotNull List slots() {
48 | return this.type().slots(this.config);
49 | }
50 |
51 | @Override
52 | public ResourceKey extends RocketPart, ?>> output() {
53 | return this.type().output(this.config);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/recipe/RocketPartRecipeSlotImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.recipe;
24 |
25 | import dev.galacticraft.api.rocket.recipe.RocketPartRecipeSlot;
26 | import net.minecraft.world.item.crafting.Ingredient;
27 | import org.jetbrains.annotations.NotNull;
28 |
29 | public record RocketPartRecipeSlotImpl(int x, int y, @NotNull Ingredient ingredient) implements RocketPartRecipeSlot {
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/travelpredicate/config/AccessWeightTravelPredicateConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.travelpredicate.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import com.mojang.serialization.codecs.RecordCodecBuilder;
27 | import dev.galacticraft.api.rocket.travelpredicate.TravelPredicateConfig;
28 | import dev.galacticraft.api.rocket.travelpredicate.TravelPredicateType;
29 |
30 | public record AccessWeightTravelPredicateConfig(int weight,
31 | TravelPredicateType.Result defaultType) implements TravelPredicateConfig {
32 | public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group(
33 | Codec.INT.fieldOf("weight").forGetter(AccessWeightTravelPredicateConfig::weight),
34 | TravelPredicateType.Result.CODEC.optionalFieldOf("default", TravelPredicateType.Result.PASS).forGetter(AccessWeightTravelPredicateConfig::defaultType)
35 | ).apply(instance, AccessWeightTravelPredicateConfig::new));
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/travelpredicate/config/AndTravelPredicateConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.travelpredicate.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.travelpredicate.ConfiguredTravelPredicate;
27 | import dev.galacticraft.api.rocket.travelpredicate.TravelPredicateConfig;
28 | import org.jetbrains.annotations.NotNull;
29 | import org.jetbrains.annotations.Unmodifiable;
30 |
31 | import java.util.List;
32 |
33 | public record AndTravelPredicateConfig(@Unmodifiable @NotNull List> predicates) implements TravelPredicateConfig {
34 | public static final Codec CODEC = ConfiguredTravelPredicate.DIRECT_CODEC.listOf().xmap(AndTravelPredicateConfig::new, AndTravelPredicateConfig::predicates);
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/travelpredicate/config/ConstantTravelPredicateConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.travelpredicate.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.travelpredicate.TravelPredicateConfig;
27 | import dev.galacticraft.api.rocket.travelpredicate.TravelPredicateType;
28 |
29 | public record ConstantTravelPredicateConfig(TravelPredicateType.Result type) implements TravelPredicateConfig {
30 | public static final Codec CODEC = TravelPredicateType.Result.CODEC.xmap(ConstantTravelPredicateConfig::new, ConstantTravelPredicateConfig::type);
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/travelpredicate/config/DefaultTravelPredicateConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.travelpredicate.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.travelpredicate.TravelPredicateConfig;
27 |
28 | public final class DefaultTravelPredicateConfig implements TravelPredicateConfig {
29 | public static final DefaultTravelPredicateConfig INSTANCE = new DefaultTravelPredicateConfig();
30 | public static final Codec CODEC = Codec.unit(INSTANCE);
31 |
32 | private DefaultTravelPredicateConfig() {
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/travelpredicate/config/OrTravelPredicateConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.travelpredicate.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.rocket.travelpredicate.ConfiguredTravelPredicate;
27 | import dev.galacticraft.api.rocket.travelpredicate.TravelPredicateConfig;
28 | import org.jetbrains.annotations.NotNull;
29 | import org.jetbrains.annotations.Unmodifiable;
30 |
31 | import java.util.List;
32 |
33 | public record OrTravelPredicateConfig(@Unmodifiable @NotNull List> predicates) implements TravelPredicateConfig {
34 | public static final Codec CODEC = ConfiguredTravelPredicate.DIRECT_CODEC.listOf().xmap(OrTravelPredicateConfig::new, OrTravelPredicateConfig::predicates);
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/travelpredicate/type/ConstantTravelPredicateType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.travelpredicate.type;
24 |
25 | import dev.galacticraft.api.rocket.part.*;
26 | import dev.galacticraft.api.rocket.travelpredicate.TravelPredicateType;
27 | import dev.galacticraft.api.universe.celestialbody.CelestialBody;
28 | import dev.galacticraft.impl.rocket.travelpredicate.config.ConstantTravelPredicateConfig;
29 |
30 | public final class ConstantTravelPredicateType extends TravelPredicateType {
31 | public static final ConstantTravelPredicateType INSTANCE = new ConstantTravelPredicateType();
32 |
33 | private ConstantTravelPredicateType() {
34 | super(ConstantTravelPredicateConfig.CODEC);
35 | }
36 |
37 | @Override
38 | public Result canTravel(CelestialBody, ?> from, CelestialBody, ?> to, RocketCone, ?> cone, RocketBody, ?> body, RocketFin, ?> fin, RocketBooster, ?> booster, RocketBottom, ?> bottom, RocketUpgrade, ?>[] upgrades, ConstantTravelPredicateConfig config) {
39 | return config.type();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/rocket/travelpredicate/type/DefaultTravelPredicateType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.rocket.travelpredicate.type;
24 |
25 | import dev.galacticraft.api.rocket.part.*;
26 | import dev.galacticraft.api.rocket.travelpredicate.ConfiguredTravelPredicate;
27 | import dev.galacticraft.api.rocket.travelpredicate.TravelPredicateType;
28 | import dev.galacticraft.api.universe.celestialbody.CelestialBody;
29 | import dev.galacticraft.impl.rocket.travelpredicate.config.DefaultTravelPredicateConfig;
30 |
31 | public final class DefaultTravelPredicateType extends TravelPredicateType {
32 | public static final DefaultTravelPredicateType INSTANCE = new DefaultTravelPredicateType();
33 | public static final ConfiguredTravelPredicate, ?> CONFIGURED = INSTANCE.configure(DefaultTravelPredicateConfig.INSTANCE);
34 |
35 | private DefaultTravelPredicateType() {
36 | super(DefaultTravelPredicateConfig.CODEC);
37 | }
38 |
39 | @Override
40 | public Result canTravel(CelestialBody, ?> from, CelestialBody, ?> to, RocketCone, ?> cone, RocketBody, ?> body, RocketFin, ?> fin, RocketBooster, ?> booster, RocketBottom, ?> bottom, RocketUpgrade, ?>[] upgrades, DefaultTravelPredicateConfig config) {
41 | return Result.PASS;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/universe/celestialbody/landable/teleporter/config/DefaultCelestialTeleporterConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.universe.celestialbody.landable.teleporter.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.universe.celestialbody.landable.teleporter.config.CelestialTeleporterConfig;
27 |
28 | public class DefaultCelestialTeleporterConfig implements CelestialTeleporterConfig {
29 | public static final DefaultCelestialTeleporterConfig INSTANCE = new DefaultCelestialTeleporterConfig();
30 | public static final Codec CODEC = Codec.unit(INSTANCE);
31 |
32 | private DefaultCelestialTeleporterConfig() {}
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/universe/display/config/EmptyCelestialDisplayConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.universe.display.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import dev.galacticraft.api.universe.display.CelestialDisplayConfig;
27 |
28 | public class EmptyCelestialDisplayConfig implements CelestialDisplayConfig {
29 | public static final EmptyCelestialDisplayConfig INSTANCE = new EmptyCelestialDisplayConfig();
30 | public static final Codec CODEC = Codec.unit(EmptyCelestialDisplayConfig.INSTANCE);
31 |
32 | private EmptyCelestialDisplayConfig() {}
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/universe/display/config/IconCelestialDisplayConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.universe.display.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import com.mojang.serialization.codecs.RecordCodecBuilder;
27 | import dev.galacticraft.api.universe.display.CelestialDisplayConfig;
28 | import net.minecraft.resources.ResourceLocation;
29 |
30 | public record IconCelestialDisplayConfig(ResourceLocation texture, int u, int v, int width, int height,
31 | float scale) implements CelestialDisplayConfig {
32 | public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group(
33 | ResourceLocation.CODEC.fieldOf("texture").forGetter(IconCelestialDisplayConfig::texture),
34 | Codec.INT.fieldOf("u").forGetter(IconCelestialDisplayConfig::u),
35 | Codec.INT.fieldOf("v").forGetter(IconCelestialDisplayConfig::v),
36 | Codec.INT.fieldOf("width").forGetter(IconCelestialDisplayConfig::width),
37 | Codec.INT.fieldOf("height").forGetter(IconCelestialDisplayConfig::height),
38 | Codec.FLOAT.fieldOf("scale").forGetter(IconCelestialDisplayConfig::scale)
39 | ).apply(instance, IconCelestialDisplayConfig::new));
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/universe/display/type/EmptyCelestialDisplayType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.universe.display.type;
24 |
25 | import com.mojang.blaze3d.vertex.BufferBuilder;
26 | import com.mojang.blaze3d.vertex.PoseStack;
27 | import dev.galacticraft.api.universe.display.CelestialDisplayType;
28 | import dev.galacticraft.impl.universe.display.config.EmptyCelestialDisplayConfig;
29 | import net.minecraft.client.renderer.ShaderInstance;
30 | import org.joml.Vector4f;
31 |
32 | import java.util.function.Consumer;
33 | import java.util.function.Supplier;
34 |
35 | public class EmptyCelestialDisplayType extends CelestialDisplayType {
36 | public static final EmptyCelestialDisplayType INSTANCE = new EmptyCelestialDisplayType();
37 |
38 | private EmptyCelestialDisplayType() {
39 | super(EmptyCelestialDisplayConfig.CODEC);
40 | }
41 |
42 | @Override
43 | public Vector4f render(PoseStack matrices, BufferBuilder buffer, int size, double mouseX, double mouseY, float delta, Consumer> shaderSetter, EmptyCelestialDisplayConfig config) {
44 | return NULL_VECTOR;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/universe/position/config/OrbitalCelestialPositionConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.universe.position.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import com.mojang.serialization.codecs.RecordCodecBuilder;
27 | import dev.galacticraft.api.universe.position.CelestialPositionConfig;
28 |
29 | public record OrbitalCelestialPositionConfig(double orbitTime, double distance, double phaseShift,
30 | boolean planet) implements CelestialPositionConfig {
31 | public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group(
32 | Codec.DOUBLE.fieldOf("orbit_time").forGetter(OrbitalCelestialPositionConfig::orbitTime),
33 | Codec.DOUBLE.fieldOf("distance").forGetter(OrbitalCelestialPositionConfig::distance),
34 | Codec.DOUBLE.fieldOf("phase_shift").forGetter(OrbitalCelestialPositionConfig::phaseShift),
35 | Codec.BOOL.fieldOf("planet").orElse(true).forGetter(OrbitalCelestialPositionConfig::planet)
36 | ).apply(instance, OrbitalCelestialPositionConfig::new));
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/universe/position/config/StaticCelestialPositionConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.universe.position.config;
24 |
25 | import com.mojang.serialization.Codec;
26 | import com.mojang.serialization.codecs.RecordCodecBuilder;
27 | import dev.galacticraft.api.universe.position.CelestialPositionConfig;
28 |
29 | public record StaticCelestialPositionConfig(double x, double y) implements CelestialPositionConfig {
30 | public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group(
31 | Codec.DOUBLE.fieldOf("x").forGetter(StaticCelestialPositionConfig::x),
32 | Codec.DOUBLE.fieldOf("y").forGetter(StaticCelestialPositionConfig::y)
33 | ).apply(instance, StaticCelestialPositionConfig::new));
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/dev/galacticraft/impl/universe/position/type/StaticCelestialPositionType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Team Galacticraft
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in all
12 | * copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | package dev.galacticraft.impl.universe.position.type;
24 |
25 | import dev.galacticraft.api.universe.position.CelestialPositionType;
26 | import dev.galacticraft.impl.universe.position.config.StaticCelestialPositionConfig;
27 |
28 | public class StaticCelestialPositionType extends CelestialPositionType {
29 | public static final StaticCelestialPositionType INSTANCE = new StaticCelestialPositionType();
30 |
31 | private StaticCelestialPositionType() {
32 | super(StaticCelestialPositionConfig.CODEC);
33 | }
34 |
35 | @Override
36 | public double x(StaticCelestialPositionConfig config, long worldTime, float delta) {
37 | return config.x();
38 | }
39 |
40 | @Override
41 | public double y(StaticCelestialPositionConfig config, long worldTime, float delta) {
42 | return config.y();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/resources/assets/galacticraft-api/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TeamGalacticraft/GalacticraftAPI/6d3bfc9452ea14d7bc22ead73a647aad482d60dc/src/main/resources/assets/galacticraft-api/icon.png
--------------------------------------------------------------------------------
/src/main/resources/assets/galacticraft-api/lang/en_us.json:
--------------------------------------------------------------------------------
1 | {
2 | "galaxy.galacticraft-api.milky_way.name": "Milky Way",
3 | "galaxy.galacticraft-api.milky_way.desc": "",
4 | "star.galacticraft-api.sol.name": "Sol",
5 | "star.galacticraft-api.sol.desc": "",
6 | "planet.galacticraft-api.earth.name": "Earth",
7 | "planet.galacticraft-api.earth.desc": "The Overworld",
8 | "ui.galacticraft-api.bodies.satellite": "Satellite",
9 |
10 | "ui.galacticraft-api.gases.hydrogen": "Hydrogen",
11 | "ui.galacticraft-api.gases.nitrogen": "Nitrogen",
12 | "ui.galacticraft-api.gases.oxygen": "Oxygen",
13 | "ui.galacticraft-api.gases.carbon_dioxide": "Carbon Dioxide",
14 | "ui.galacticraft-api.gases.water_vapor": "Water Vapor",
15 | "ui.galacticraft-api.gases.methane": "Methane",
16 | "ui.galacticraft-api.gases.helium": "Helium",
17 | "ui.galacticraft-api.gases.argon": "Argon",
18 | "ui.galacticraft-api.gases.neon": "Neon",
19 | "ui.galacticraft-api.gases.krypton": "Krypton",
20 | "ui.galacticraft-api.gases.nitrous_oxide": "Nitrous Oxide",
21 | "ui.galacticraft-api.gases.carbon_monoxide": "Carbon Monoxide",
22 | "ui.galacticraft-api.gases.xenon": "Xenon",
23 | "ui.galacticraft-api.gases.ozone": "Ozone",
24 | "ui.galacticraft-api.gases.nitrous_dioxide": "Nitrous Dioxide",
25 | "ui.galacticraft-api.gases.iodine": "Iodine",
26 |
27 | "command.galacticraft-api.debug.registry.dump": "Dumped: %s",
28 | "command.galacticraft-api.debug.registry.id": "%s - %s: %s"
29 | }
--------------------------------------------------------------------------------
/src/main/resources/assets/galacticraft-api/textures/body_icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TeamGalacticraft/GalacticraftAPI/6d3bfc9452ea14d7bc22ead73a647aad482d60dc/src/main/resources/assets/galacticraft-api/textures/body_icons.png
--------------------------------------------------------------------------------
/src/main/resources/assets/galacticraft-api/textures/gui/player_inventory_switch_tabs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TeamGalacticraft/GalacticraftAPI/6d3bfc9452ea14d7bc22ead73a647aad482d60dc/src/main/resources/assets/galacticraft-api/textures/gui/player_inventory_switch_tabs.png
--------------------------------------------------------------------------------
/src/main/resources/assets/galacticraft-api/textures/satellite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TeamGalacticraft/GalacticraftAPI/6d3bfc9452ea14d7bc22ead73a647aad482d60dc/src/main/resources/assets/galacticraft-api/textures/satellite.png
--------------------------------------------------------------------------------
/src/main/resources/fabric.mod.json:
--------------------------------------------------------------------------------
1 | {
2 | "schemaVersion": 1,
3 | "id": "galacticraft-api",
4 | "version": "$version",
5 |
6 | "name": "Galacticraft Addon API",
7 | "icon": "assets/galacticraft-api/icon.png",
8 | "description": "Addon API for the FabricMC port of Galacticraft.",
9 | "license": "MIT",
10 | "contact": {
11 | "homepage": "https://galacticraft.team",
12 | "sources": "https://github.com/TeamGalacticraft/GalacticraftAPI",
13 | "issues": "https://github.com/TeamGalacticraft/GalacticraftAPI/issues"
14 | },
15 | "authors": [
16 | {
17 | "name": "Team Galacticraft",
18 | "contact": {
19 | "homepage": "https://github.com/TeamGalacticraft",
20 | "discord": "https://discord.gg/n3QqhMYyFK"
21 | }
22 | }
23 | ],
24 | "environment": "*",
25 | "entrypoints": {
26 | "main": [
27 | "dev.galacticraft.impl.internal.fabric.GalacticraftAPI"
28 | ],
29 | "client": [
30 | "dev.galacticraft.impl.internal.client.fabric.GalacticraftAPIClient"
31 | ],
32 | "fabric-datagen": [
33 | "dev.galacticraft.impl.internal.fabric.GalacticraftAPIData"
34 | ]
35 | },
36 | "mixins": [
37 | "galacticraft-api.mixins.json"
38 | ],
39 | "accessWidener": "galacticraft-api.accesswidener",
40 | "depends": {
41 | "fabricloader": ">=0.14",
42 | "minecraft": ">=1.20.1",
43 | "fabric-api-base": "*",
44 | "fabric-api-lookup-api-v1": "*",
45 | "fabric-command-api-v2": "*",
46 | "fabric-lifecycle-events-v1": "*",
47 | "fabric-networking-api-v1": "*",
48 | "fabric-registry-sync-v0": "*",
49 | "fabric-renderer-api-v1": "*",
50 | "fabric-resource-loader-v0": "*",
51 | "fabric-transfer-api-v1": "*"
52 | },
53 | "suggests": {
54 | "modmenu": ">=4.0.0",
55 | "galacticraft": "*"
56 | },
57 | "custom": {
58 | "loom:injected_interfaces": {
59 | "net/minecraft/class_742": ["dev/galacticraft/api/accessor/GearInventoryProvider"],
60 | "net/minecraft/class_1309": ["dev/galacticraft/api/accessor/GearInventoryProvider"],
61 | "net/minecraft/class_1937": ["dev/galacticraft/api/accessor/LevelOxygenAccessor"],
62 | "net/minecraft/class_3222": ["dev/galacticraft/api/accessor/GearInventoryProvider"]
63 | },
64 | "modmenu": {
65 | "badges": [ "library" ],
66 | "parent": "galacticraft"
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/resources/galacticraft-api.accesswidener:
--------------------------------------------------------------------------------
1 | accessWidener v1 named
2 | accessible class net/minecraft/core/registries/BuiltInRegistries$RegistryBootstrap
3 | accessible class net/minecraft/core/RegistrySynchronization$NetworkedRegistryData
4 |
--------------------------------------------------------------------------------
/src/main/resources/galacticraft-api.mixins.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "package": "dev.galacticraft.impl.internal.mixin",
4 | "compatibilityLevel": "JAVA_17",
5 | "mixins": [
6 | "MinecraftServerMixin",
7 | "client.AbstractContainerScreenMixin",
8 | "gear.LivingEntityMixin",
9 | "gear.PlayerListMixin",
10 | "gear.ServerPlayerMixin",
11 | "gravity.EntityGravityMixin",
12 | "gravity.LivingEntityMixin",
13 | "oxygen.ChunkHolderMixin",
14 | "oxygen.ChunkSerializerMixin",
15 | "oxygen.EmptyLevelChunkMixin",
16 | "oxygen.ImposterProtoChunkMixin",
17 | "oxygen.LevelChunkMixin",
18 | "oxygen.LevelChunkSectionMixin",
19 | "oxygen.LevelMixin",
20 | "oxygen.ProtoChunkMixin",
21 | "registry.RegistryDataLoaderMixin",
22 | "registry.RegistrySyncronizationMixin",
23 | "research.AdvancementRewardsMixin",
24 | "research.ServerPlayerMixin"
25 | ],
26 | "client": [
27 | "client.AbstractClientPlayerEntityMixin",
28 | "client.ClientPlayNetworkHandlerMixin",
29 | "client.MinecraftClientMixin",
30 | "client.ParticleAccessor",
31 | "client.ParticleManagerMixin",
32 | "client.SoundEngineMixin",
33 | "client.SoundManagerAccessor"
34 | ],
35 | "minVersion": "0.8.0",
36 | "injectors": {
37 | "defaultRequire": 1
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/test/resources/data/gc-api-test/advancements/custom/example_part.json:
--------------------------------------------------------------------------------
1 | {
2 | "parent": "gc-api-test:custom/root",
3 | "display": {
4 | "icon": {
5 | "item": "minecraft:diamond_block"
6 | },
7 | "title": {
8 | "translate": "gc-api-test.advancements.custom.diamond_block.title"
9 | },
10 | "description": {
11 | "translate": "gc-api-test.advancements.custom.diamond_block.description"
12 | },
13 | "frame": "challenge",
14 | "show_toast": true,
15 | "announce_to_chat": true,
16 | "hidden": false
17 | },
18 | "rewards": {
19 | "rocket_parts": [
20 | "gc-api-test:test"
21 | ]
22 | },
23 | "criteria": {
24 | "diamond_block": {
25 | "trigger": "minecraft:inventory_changed",
26 | "conditions": {
27 | "items": [
28 | {
29 | "item": "minecraft:diamond_block"
30 | }
31 | ]
32 | }
33 | }
34 | },
35 | "requirements": [
36 | [
37 | "diamond_block"
38 | ]
39 | ]
40 | }
--------------------------------------------------------------------------------
/src/test/resources/data/gc-api-test/advancements/custom/root.json:
--------------------------------------------------------------------------------
1 | {
2 | "display": {
3 | "icon": {
4 | "item": "minecraft:gold_block"
5 | },
6 | "title": {
7 | "translate": "gc-api-test.advancements.custom.root.title"
8 | },
9 | "description": {
10 | "translate": "gc-api-test.advancements.custom.root.description"
11 | },
12 | "frame": "task",
13 | "show_toast": false,
14 | "announce_to_chat": false,
15 | "hidden": false,
16 | "background": "minecraft:textures/block/iron_block.png"
17 | },
18 | "criteria": {
19 | "gold_block": {
20 | "trigger": "minecraft:inventory_changed",
21 | "conditions": {
22 | "items": [
23 | {
24 | "item": "minecraft:gold_block"
25 | }
26 | ]
27 | }
28 | }
29 | },
30 | "requirements": [
31 | [
32 | "gold_block"
33 | ]
34 | ]
35 | }
--------------------------------------------------------------------------------
/src/test/resources/data/gc-api-test/celestial_body/example_planet.json:
--------------------------------------------------------------------------------
1 | {
2 | "config": {
3 | "access_weight": 0,
4 | "day_temperature": 21,
5 | "night_temperature": 15,
6 | "world": "minecraft:the_end",
7 | "teleporter": {
8 | "type": "galacticraft-api:direct",
9 | "config": {}
10 | },
11 | "atmosphere": {
12 | "composition": {
13 | "galacticraft-api:nitrogen": 780840,
14 | "galacticraft-api:oxygen": 209500,
15 | "galacticraft-api:water_vapor": 25000,
16 | "galacticraft-api:argon": 9300,
17 | "galacticraft-api:carbon_dioxide": 399,
18 | "galacticraft-api:neon": 18,
19 | "galacticraft-api:helium": 5.42,
20 | "galacticraft-api:methane": 1.79,
21 | "galacticraft-api:krypton": 1.14,
22 | "galacticraft-api:hydrogen": 0.55,
23 | "galacticraft-api:nitrous_oxide": 0.325,
24 | "galacticraft-api:carbon_monoxide": 0.1,
25 | "galacticraft-api:xenon": 0.09,
26 | "galacticraft-api:ozone": 0.07,
27 | "galacticraft-api:nitrous_dioxide": 0.02,
28 | "galacticraft-api:iodine": 0.01
29 | },
30 | "temperature": 15,
31 | "pressure": 1
32 | },
33 | "gravity": 1,
34 | "parent": "gc-api-test:example_star",
35 | "position": {
36 | "config": {
37 | "orbit_time": 1536000,
38 | "distance": 1,
39 | "phase_shift": 0,
40 | "planet": true
41 | },
42 | "type": "galacticraft-api:orbital"
43 | },
44 | "display": {
45 | "config": {
46 | "width": 16,
47 | "height": 16,
48 | "scale": 1,
49 | "texture": "galacticraft-api:textures/body_icons.png",
50 | "u": 0,
51 | "v": 16
52 | },
53 | "type": "galacticraft-api:icon"
54 | },
55 | "name": "planet.gc-api-test.the_end.name",
56 | "description": "planet.gc-api-test.the_end.description",
57 | "galaxy": "gc-api-test:galaxy"
58 | },
59 | "type": "galacticraft-api:planet"
60 | }
61 |
--------------------------------------------------------------------------------
/src/test/resources/data/gc-api-test/celestial_body/example_star.json:
--------------------------------------------------------------------------------
1 | {
2 | "config": {
3 | "gravity": 28,
4 | "luminance": 1,
5 | "surface_temperature": 5772,
6 | "display": {
7 | "config": {
8 | "width": 16,
9 | "height": 16,
10 | "scale": 1.5,
11 | "texture": "galacticraft-api:textures/body_icons.png",
12 | "u": 0,
13 | "v": 0
14 | },
15 | "type": "galacticraft-api:icon"
16 | },
17 | "photospheric_composition": {
18 | "composition": {
19 | "galacticraft-api:hydrogen": 734600,
20 | "galacticraft-api:helium": 248500,
21 | "galacticraft-api:oxygen": 7700,
22 | "galacticraft-api:neon": 1200,
23 | "galacticraft-api:nitrogen": 900
24 | },
25 | "temperature": 15,
26 | "pressure": 28
27 | },
28 | "name": "star.gc-api-test.star.name",
29 | "description": "star.gc-api-test.star.description",
30 | "galaxy": "gc-api-test:example_galaxy",
31 | "position": {
32 | "config": {
33 | "x": 0,
34 | "y": 0
35 | },
36 | "type": "galacticraft-api:static"
37 | }
38 | },
39 | "type": "galacticraft-api:star"
40 | }
41 |
--------------------------------------------------------------------------------
/src/test/resources/data/gc-api-test/galaxy/example_galaxy.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "galaxy.gc-api-test.galaxy.name",
3 | "description": "galaxy.gc-api-test.galaxy.description",
4 | "position": {
5 | "config": {
6 | "x": 0,
7 | "y": 0
8 | },
9 | "type": "galacticraft-api:static"
10 | },
11 | "display": {
12 | "config": {},
13 | "type": "galacticraft-api:empty"
14 | }
15 | }
--------------------------------------------------------------------------------
/src/test/resources/fabric.mod.json:
--------------------------------------------------------------------------------
1 | {
2 | "schemaVersion": 1,
3 | "id": "gc-api-test",
4 | "version": "0.1.0",
5 |
6 | "name": "Galacticraft API Test Mod",
7 | "description": "Test mod for the Addon API for the FabricMC port of Galacticraft.",
8 | "license": "MIT",
9 | "contact": {
10 | "homepage": "https://galacticraft.team/",
11 | "sources": "https://github.com/TeamGalacticraft/Addon-API/",
12 | "issues": "https://github.com/TeamGalacticraft/Addon-API/issues/"
13 | },
14 | "authors": [
15 | {
16 | "name": "Team Galacticraft",
17 | "contact": {
18 | "homepage": "https://github.com/TeamGalacticraft/",
19 | "discord": "https://discord.gg/n3QqhMYyFK"
20 | }
21 | }
22 | ],
23 | "environment": "*",
24 | "entrypoints": {
25 | "fabric-gametest": [ "dev.galacticraft.api.gametest.GalacticraftApiTestSuite" ]
26 | },
27 | "depends": {
28 | "galacticraft-api": "*"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------