Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
Shuffle around a lot of constants. Categorize.
Browse files Browse the repository at this point in the history
  • Loading branch information
robotgryphon committed Feb 8, 2024
1 parent bbafca8 commit 4422398
Show file tree
Hide file tree
Showing 52 changed files with 207 additions and 336 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ like the dimension/registry keys, location-related classes, and block/item tags.
## Common Main (core)
Contains core mod code such as structure generation, math, advancements, and data classes.

## Room API (room-api)
Contains classes and systems for working with machine rooms.

- Player Room History Management
- Room Owner Management
- Room Registration Systems
- Room Spawn Management

## Room Upgrade API (room-upgrade-api)
17 changes: 0 additions & 17 deletions core-api/src/main/java/dev/compactmods/machines/api/CMBlocks.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.api.core;
package dev.compactmods.machines.api;

public interface Constants {
String MOD_ID = "compactmachines";
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.api.core;
package dev.compactmods.machines.api;

import net.minecraft.resources.ResourceLocation;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.api.core;
package dev.compactmods.machines.api;

import net.minecraft.resources.ResourceLocation;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.compactmods.machines.api.core;
package dev.compactmods.machines.api.advancement;

import dev.compactmods.machines.api.Constants;
import net.minecraft.resources.ResourceLocation;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.codec;
package dev.compactmods.machines.api.codec;

import com.mojang.serialization.Codec;
import net.minecraft.Util;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.codec;
package dev.compactmods.machines.api.codec;

import com.mojang.serialization.DataResult;
import com.mojang.serialization.DynamicOps;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.codec;
package dev.compactmods.machines.api.codec;

import com.google.common.collect.ImmutableSet;
import net.minecraft.nbt.Tag;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dev.compactmods.machines.api.core;
package dev.compactmods.machines.api.command;

import net.minecraft.resources.ResourceLocation;

import static dev.compactmods.machines.api.core.Constants.MOD_ID;
import static dev.compactmods.machines.api.Constants.MOD_ID;

public interface CMCommands {
ResourceLocation LEVEL_REGISTERED = new ResourceLocation(MOD_ID, "level_registered");
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.compactmods.machines.api.dimension;

import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -13,7 +12,7 @@
import net.minecraft.world.level.storage.LevelStorageSource;
import org.jetbrains.annotations.NotNull;

import static dev.compactmods.machines.api.core.Constants.MOD_ID;
import static dev.compactmods.machines.api.Constants.MOD_ID;

public abstract class CompactDimension {
public static final ResourceKey<Level> LEVEL_KEY = ResourceKey
Expand All @@ -40,7 +39,6 @@ public static DimensionDataStorage getDataStorage(@NotNull LevelStorageSource.Le
return new DimensionDataStorage(dimPath.resolve("data").toFile(), fixer);
}

@NotNull
public static boolean isLevelCompact(Level level) {
return level.dimension().equals(LEVEL_KEY);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package dev.compactmods.machines.api.location;

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import dev.compactmods.machines.api.codec.CodecExtensions;
import net.minecraft.core.BlockPos;
import net.minecraft.core.GlobalPos;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3;

public record GlobalPosWithRotation(ResourceKey<Level> dimension, Vec3 position, Vec2 rotation) {

/*
* BlockPos also technically supported here, since pos matches GlobalPos.CODEC#pos - only difference
* here is that BlockPos uses an INT stream, while VEC3D uses a double stream.
*/
public static final Codec<GlobalPosWithRotation> CODEC = RecordCodecBuilder.create(i -> i.group(
ResourceKey.codec(Registries.DIMENSION).fieldOf("dimension").forGetter(GlobalPosWithRotation::dimension),
CodecExtensions.VECTOR3D.fieldOf("pos").forGetter(GlobalPosWithRotation::position),
CodecExtensions.VEC2.optionalFieldOf("rot", Vec2.ZERO).forGetter(x -> x.rotation)
).apply(i, GlobalPosWithRotation::new));

public static final GlobalPosWithRotation INVALID = new GlobalPosWithRotation(GlobalPos.of(Level.OVERWORLD, BlockPos.ZERO), Vec2.ZERO);

public GlobalPosWithRotation(GlobalPos pos, Vec2 rotation) {
this(pos.dimension(), Vec3.atBottomCenterOf(pos.pos()), rotation);
}

public GlobalPosWithRotation(ResourceKey<Level> dimension, BlockPos position, Vec2 rotation) {
this(dimension, Vec3.atBottomCenterOf(position), rotation);
}

public static GlobalPosWithRotation fromPlayer(Player player) {
return new GlobalPosWithRotation(player.level().dimension(), player.position(), new Vec2(player.xRotO, player.yRotO));
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package dev.compactmods.machines.api.machine;

public interface IMachineBlockEntity {
public interface IColoredMachine {
int getColor();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package dev.compactmods.machines.api.machine;

import dev.compactmods.machines.api.Constants;
import dev.compactmods.machines.api.util.KeyHelper;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;

public interface MachineConstants {

ResourceLocation BOUND_MACHINE_BLOCK_ID = new ResourceLocation(Constants.MOD_ID, "machine");
ResourceLocation BOUND_MACHINE_ENTITY = new ResourceLocation(Constants.MOD_ID, "machine");

ResourceLocation UNBOUND_MACHINE_BLOCK_ID = new ResourceLocation(Constants.MOD_ID, "new_machine");
ResourceLocation UNBOUND_MACHINE_ITEM_ID = new ResourceLocation(Constants.MOD_ID, "new_machine");
ResourceLocation UNBOUND_MACHINE_ENTITY = new ResourceLocation(Constants.MOD_ID, "new_machine");

ResourceKey<Block> UNBOUND_MACHINE_BLOCK_RESKEY = KeyHelper.blockResKey("new_machine");
ResourceKey<Item> UNBOUND_MACHINE_ITEM_RESKEY = KeyHelper.itemResKey("new_machine");

/**
* Marks a block as an unbound Compact Machine; applied only to machines that are not yet bound to a room.
*/
TagKey<Block> UNBOUND_MACHINE_BLOCK = KeyHelper.blockTag("new_machine");

/**
* Marks a block as a bound Compact Machine; applied only to machines that are bound to a room.
*/
TagKey<Block> BOUND_MACHINE_BLOCK = KeyHelper.blockTag("bound_machine");

TagKey<Block> MACHINE_BLOCK = KeyHelper.blockTag("machine");
TagKey<Item> MACHINE_ITEM = KeyHelper.itemTagKey("machine");

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package dev.compactmods.machines.api.room;

import dev.compactmods.machines.api.util.KeyHelper;
import net.minecraft.resources.ResourceKey;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;

public interface WallConstants {

ResourceKey<Block> BREAKABLE_WALL = KeyHelper.blockResKey("wall");
ResourceKey<Block> SOLID_WALL = KeyHelper.blockResKey("solid_wall");

/**
* Applied to solid wall items.
*/
TagKey<Item> TAG_SOLID_WALL_ITEMS = KeyHelper.itemTagKey("solid_walls");

/**
* Applied to solid walls and tunnel blocks.
*/
TagKey<Block> TAG_SOLID_WALL_BLOCKS = KeyHelper.blockTag("solid_walls");


}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dev.compactmods.machines.api.shrinking;

import dev.compactmods.machines.api.core.Constants;
import net.minecraft.core.Registry;
import dev.compactmods.machines.api.Constants;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
Expand Down
Loading

0 comments on commit 4422398

Please sign in to comment.