Skip to content

Commit

Permalink
feat: more buggy stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaMode committed Jun 8, 2024
1 parent 8087210 commit 4dcd3b4
Show file tree
Hide file tree
Showing 43 changed files with 1,139 additions and 236 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"variants": {
"part=center": {
"model": "galacticraft:block/fueling_pad_center"
},
"part=east": {
"model": "galacticraft:block/fueling_pad_side",
"y": 90
},
"part=none": {
"model": "galacticraft:block/fueling_pad_center"
},
"part=north": {
"model": "galacticraft:block/fueling_pad_side"
},
"part=north_east": {
"model": "galacticraft:block/fueling_pad_corner",
"y": 90
},
"part=north_west": {
"model": "galacticraft:block/fueling_pad_corner"
},
"part=south": {
"model": "galacticraft:block/fueling_pad_side",
"y": 180
},
"part=south_east": {
"model": "galacticraft:block/fueling_pad_corner",
"y": 180
},
"part=south_west": {
"model": "galacticraft:block/fueling_pad_corner",
"y": 270
},
"part=west": {
"model": "galacticraft:block/fueling_pad_side",
"y": 270
}
}
}
1 change: 1 addition & 0 deletions src/main/generated/assets/galacticraft/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"block.galacticraft.fluid_pipe_walkway": "Fluid Pipe Walkway",
"block.galacticraft.fuel": "Fuel",
"block.galacticraft.fuel_loader": "Fuel Loader",
"block.galacticraft.fueling_pad": "Fueling Pad",
"block.galacticraft.galena_ore": "Galena Ore",
"block.galacticraft.glass_fluid_pipe": "Glass Fluid Pipe",
"block.galacticraft.glowstone_lantern": "Glowstone Lantern",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"parent": "galacticraft:block/rocket_launch_pad_part",
"textures": {
"bottom": "galacticraft:block/fueling_pad",
"particle": "galacticraft:block/fueling_pad_corner",
"side": "galacticraft:block/fueling_pad",
"top": "galacticraft:block/fueling_pad_corner"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"parent": "galacticraft:block/rocket_launch_pad_part",
"textures": {
"bottom": "galacticraft:block/fueling_pad",
"particle": "galacticraft:block/fueling_pad_side",
"side": "galacticraft:block/fueling_pad",
"top": "galacticraft:block/fueling_pad_side"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "galacticraft:block/fueling_pad_center"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_compressed_steel": {
"conditions": {
"items": [
{
"items": [
"galacticraft:compressed_steel"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "galacticraft:fueling_pad"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_compressed_steel"
]
],
"rewards": {
"recipes": [
"galacticraft:fueling_pad"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"conditions": [
{
"block": "galacticraft:fueling_pad",
"condition": "minecraft:block_state_property",
"properties": {
"part": "none"
}
}
],
"name": "galacticraft:fueling_pad"
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"conditions": [
{
"block": "galacticraft:fueling_pad",
"condition": "minecraft:block_state_property",
"properties": {
"part": "center"
}
}
],
"name": "galacticraft:fueling_pad"
}
],
"rolls": 9.0
}
]
}
20 changes: 20 additions & 0 deletions src/main/generated/data/galacticraft/recipes/fueling_pad.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"C": {
"item": "galacticraft:compressed_steel"
},
"I": {
"item": "minecraft:iron_block"
}
},
"pattern": [
"CCC",
"III"
],
"result": {
"count": 9,
"item": "galacticraft:fueling_pad"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"galacticraft:mars_cobblestone_stairs",
"galacticraft:fallen_meteor",
"galacticraft:tin_ladder",
"galacticraft:fueling_pad",
"galacticraft:rocket_launch_pad",
"galacticraft:glowstone_lantern",
"galacticraft:unlit_lantern",
Expand Down
18 changes: 2 additions & 16 deletions src/main/java/dev/galacticraft/api/rocket/entity/Rocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import dev.galacticraft.api.rocket.LaunchStage;
import dev.galacticraft.api.rocket.RocketData;
import dev.galacticraft.api.rocket.part.*;
import dev.galacticraft.mod.api.entity.Dockable;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.fabricmc.fabric.api.transfer.v1.storage.Storage;
import net.minecraft.core.BlockPos;
Expand All @@ -34,7 +35,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public interface Rocket extends RocketData {
public interface Rocket extends RocketData, Dockable {
/**
* Returns the launch stage of this rocket.
* @return the launch stage of this rocket.
Expand All @@ -57,32 +58,17 @@ public interface Rocket extends RocketData {

@NotNull BlockPos getLinkedPad();

void setLinkedPad(@NotNull BlockPos linkedPad);

/**
* Called when the player riding the rocket jumps
* Used to initiate the launch countdown in the rocket
*/
void onJump();


/**
* Called when the rocket launch pad linked to this rocket is destroyed
*/
void onBaseDestroyed();

/**
* Called when the rocket is destroyed
*
* @param source the type of damage inflicted on this rocket
* @param exploded whether the damage is self-inflicted (the rocket failed)
*/
void dropItems(DamageSource source, boolean exploded);

@Nullable Fluid getFuelTankFluid();
long getFuelTankAmount();
long getFuelTankCapacity();
Storage<FluidVariant> getFuelTank();

Entity asEntity();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package dev.galacticraft.api.universe.celestialbody;

import com.mojang.serialization.Codec;
import dev.galacticraft.api.entity.attribute.GcApiEntityAttributes;
import dev.galacticraft.api.gas.GasComposition;
import dev.galacticraft.api.registry.AddonRegistries;
import dev.galacticraft.api.registry.BuiltInAddonRegistries;
Expand All @@ -36,6 +37,9 @@
import net.minecraft.resources.RegistryFileCodec;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -83,6 +87,15 @@ public static <C extends CelestialBodyConfig, T extends CelestialBodyType<C> & L
return Optional.empty();
}

public static double getGravity(Entity entity) {
if (entity instanceof LivingEntity living) {
AttributeInstance attribute = living.getAttribute(GcApiEntityAttributes.LOCAL_GRAVITY_LEVEL);
if (attribute != null && attribute.getValue() > 0)
return attribute.getValue() * 0.08d;
}
return CelestialBody.getByDimension(entity.level()).map(celestialBodyType -> celestialBodyType.gravity() * 0.08d).orElse(0.08);
}

/**
* Returns the name of this celestial body
* Be sure to {@link Component#copy() copy} the returned text if you intend on stylizing it.
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/dev/galacticraft/mod/Constant.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ interface Block {
String GAS_LIQUEFIER = "gas_liquefier";

// Pad Blocks
String BUGGY_FUELING_PAD = "buggy_fueling";
String FUELING_PAD = "fueling_pad";
String ROCKET_LAUNCH_PAD = "rocket_launch_pad";
String FUEL_LOADER = "fuel_loader";
String CARGO_LOADER = "cargo_loader";
Expand Down Expand Up @@ -447,6 +447,7 @@ interface Item {
String ISOTHERMAL_PADDING_LEGGINGS = "isothermal_padding_leggings";
String ISOTHERMAL_PADDING_BOOTS = "isothermal_padding_boots";

String BUGGY = "buggy";
String ROCKET = "rocket";

String TIER_2_ROCKET_SCHEMATIC = "tier_2_rocket_schematic";
Expand Down
51 changes: 51 additions & 0 deletions src/main/java/dev/galacticraft/mod/api/block/entity/FuelDock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2019-2024 Team Galacticraft
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package dev.galacticraft.mod.api.block.entity;

import dev.galacticraft.mod.api.entity.Dockable;
import net.minecraft.core.BlockPos;
import org.jetbrains.annotations.Nullable;

public interface FuelDock {
/**
* Gets the docked entity.
*
* @return the docked entity
*/
@Nullable
Dockable getDockedEntity();

/**
* Dock entity.
*
* @param entity the entity
*/
void setDockedEntity(Dockable entity);

/**
* Gets the position of the dock
*
* @return the dock position
*/
BlockPos getDockPos();
}
42 changes: 42 additions & 0 deletions src/main/java/dev/galacticraft/mod/api/entity/CargoEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2019-2024 Team Galacticraft
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package dev.galacticraft.mod.api.entity;

import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;

/**
* Implement into entities that can be loaded with cargo
*/
public interface CargoEntity {
enum CargoLoadingState {
FULL, EMPTY, NO_TARGET, NO_INVENTORY, SUCCESS
}

record RemovalResult(CargoLoadingState resultState, @NotNull ItemStack resultStack) {
}

CargoLoadingState addCargo(ItemStack stack, boolean simulate);

RemovalResult removeCargo(boolean simulate);
}
Loading

0 comments on commit 4dcd3b4

Please sign in to comment.