Skip to content

Commit

Permalink
Merge branch 'next-4.3.0' into 1.18.x
Browse files Browse the repository at this point in the history
  • Loading branch information
robotgryphon committed May 28, 2022
2 parents b09e0f7 + 29b9af6 commit 473d99e
Show file tree
Hide file tree
Showing 145 changed files with 4,593 additions and 3,002 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ logs/
*.dot

src/generated/

raw-assets/
86 changes: 53 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public' }
mavenCentral()
mavenLocal()
}

dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:5.1.+"
classpath "org.spongepowered:mixingradle:${mixingradle_version}"
}
}

Expand All @@ -17,6 +19,7 @@ plugins {
}

apply plugin: "net.minecraftforge.gradle"
apply plugin: 'org.spongepowered.mixin'

def semver = { ->
try {
Expand Down Expand Up @@ -130,6 +133,7 @@ minecraft {
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"

arg '-mixin.config=compactmachines.mixin.json'
args '--username', 'Dev'
args '--width', 1920
args '--height', 1080
Expand Down Expand Up @@ -157,6 +161,8 @@ minecraft {
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"

arg '-mixin.config=compactmachines.mixin.json'

mods {
compactmachines {
source sourceSets.tunnels
Expand Down Expand Up @@ -215,7 +221,7 @@ minecraft {
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"

forceExit false

mods {
compactmachines {
source sourceSets.tunnels
Expand Down Expand Up @@ -246,7 +252,11 @@ repositories {

// TheOneProbe
maven {
name 'tterrag maven'
url "https://maven.k-4u.nl"
}

maven {
name "tterrag maven"
url "https://maven.tterrag.com/"
}
}
Expand All @@ -263,36 +273,45 @@ dependencies {

// The One Probe
implementation(fg.deobf("curse.maven:theoneprobe-245211:3671753"))
// compileOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-1.16:${top_version}:api")
// runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-1.16:${top_version}")

// Nicephore - Screenshots and Stuff
runtimeOnly(fg.deobf("curse.maven:nicephore-401014:3651214"))

// Shut up Experimental Settings - so we don't have to deal with that CONSTANTLY
runtimeOnly(fg.deobf("curse.maven:shutupexperimental-407174:3544525"))

// // Testing Mods - Trash Cans, Pipez, Create, Refined Pipes, Pretty Pipes, Refined Storage
// runtimeOnly(fg.deobf("curse.maven:SuperMartijn642-454372:3649270"))
// runtimeOnly(fg.deobf("curse.maven:trashcans-394535:3597654"))
// runtimeOnly(fg.deobf("curse.maven:pipez-443900:3569514"))
// runtimeOnly(fg.deobf("curse.maven:flywheel-486392:3687357"))
// runtimeOnly(fg.deobf("curse.maven:create-328085:3687358"))
// runtimeOnly(fg.deobf("curse.maven:refinedpipes-370696:3570151"))
// runtimeOnly(fg.deobf("curse.maven:prettypipes-376737:3573145"))
// runtimeOnly(fg.deobf("curse.maven:refinedstorage-243076:3623324"))
//
// // Scalable Cat's Force, BdLib, Advanced Generators
// runtimeOnly(fg.deobf("curse.maven:scalable-320926:3634756"))
// runtimeOnly(fg.deobf("curse.maven:bdlib-70496:3663149"))
// runtimeOnly(fg.deobf("curse.maven:advgen-223622:3665335"))
//
// // Immersive Eng - 7.1.0-145 (Dec 31)
// runtimeOnly(fg.deobf("curse.maven:immersiveeng-231951:3587149"))

// Mekanism + Mek Generators - Tunnel testing
// runtimeOnly(fg.deobf("curse.maven:mekanism-268560:3206392"))
// runtimeOnly(fg.deobf("curse.maven:mekanismgenerators-268566:3206395"))

if (!System.getenv().containsKey("CI") && include_test_mods) {
// Nicephore - Screenshots and Stuff
runtimeOnly(fg.deobf("curse.maven:nicephore-401014:3741832"))

// // Testing Mods - Trash Cans, Pipez, Create, Refined Pipes, Pretty Pipes, Refined Storage
runtimeOnly(fg.deobf("curse.maven:SuperMartijn642-454372:3649270"))
runtimeOnly(fg.deobf("curse.maven:trashcans-394535:3597654"))
runtimeOnly(fg.deobf("curse.maven:pipez-443900:3760255"))

runtimeOnly(fg.deobf("curse.maven:flywheel-486392:3737402"))
runtimeOnly(fg.deobf("curse.maven:create-328085:3737418"))

// runtimeOnly(fg.deobf("curse.maven:refinedpipes-370696:3570151"))
// runtimeOnly(fg.deobf("curse.maven:prettypipes-376737:3573145"))
// runtimeOnly(fg.deobf("curse.maven:refinedstorage-243076:3623324"))
//
// // Scalable Cat's Force, BdLib, Advanced Generators
// runtimeOnly(fg.deobf("curse.maven:scalable-320926:3634756"))
// runtimeOnly(fg.deobf("curse.maven:bdlib-70496:3663149"))
// runtimeOnly(fg.deobf("curse.maven:advgen-223622:3665335"))
//
// // Immersive Eng - 7.1.0-145 (Dec 31)
// runtimeOnly(fg.deobf("curse.maven:immersiveeng-231951:3587149"))

// FTB Chunks
runtimeOnly(fg.deobf("curse.maven:architectury-forge-419699:3781711"))
runtimeOnly(fg.deobf("curse.maven:ftb-teams-404468:3725501"))
runtimeOnly(fg.deobf("curse.maven:ftblib-404465:3725485"))
runtimeOnly(fg.deobf("curse.maven:ftbchunks-314906:3780113"))

// Mekanism + Mek Generators - Tunnel testing
runtimeOnly(fg.deobf("curse.maven:mekanism-268560:3743835"))
runtimeOnly(fg.deobf("curse.maven:mekanismgenerators-268566:3743837"))
}
}

mixin {
add sourceSets.main, "${mod_id}.refmap.json"
}

processResources {
Expand Down Expand Up @@ -323,7 +342,8 @@ jar {
"Implementation-Title" : project.name,
"Implementation-Version" : archiveVersion,
"Implementation-Vendor" : "",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'MixinConfigs': "${mod_id}.mixin.json"
])
}
}
Expand Down
8 changes: 7 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ mod_id=compactmachines

# Dependencies and Libs
jei_mc_version=1.18.2
jei_version=9.5.2.135
jei_version=9.7.0.194
#top_version=1.16-3.1.4-22

# Curseforge
cf_project=224218
cf_release_type=release

# Plugins that shall not be named
mixin_version = 0.8.5
mixingradle_version = 0.7-SNAPSHOT

include_test_mods = true
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ public class Advancements {
public static final ResourceLocation CLAIMED_LARGE_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_large");
public static final ResourceLocation CLAIMED_GIANT_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_giant");
public static final ResourceLocation CLAIMED_MAX_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_max");

public static final ResourceLocation RECURSIVE_ROOMS = new ResourceLocation(Constants.MOD_ID, "recursion");
}
17 changes: 10 additions & 7 deletions src/api/java/dev/compactmods/machines/api/core/CMCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,29 @@
public class CMCommands {
public static final ResourceLocation LEVEL_REGISTERED = new ResourceLocation(MOD_ID, "level_registered");
public static final ResourceLocation LEVEL_NOT_FOUND = new ResourceLocation(MOD_ID, "level_not_found");
public static final ResourceLocation ROOM_DATA_NOT_FOUND = new ResourceLocation(MOD_ID, "room_data_not_found");

/**
* Used for displaying the number of registered machines via summary commands.
*/
public static final ResourceLocation MACHINE_REG_COUNT = new ResourceLocation(MOD_ID, "machine_reg_count");
public static final ResourceLocation MACHINE_REG_DIM = new ResourceLocation(MOD_ID, "summary.machines.dimension");
public static final ResourceLocation MACHINE_REG_TOTAL = new ResourceLocation(MOD_ID, "summary.machines.total");

/**
* Used for displaying the number of registered rooms via summary commands.
*/
public static final ResourceLocation ROOM_REG_COUNT = new ResourceLocation(MOD_ID, "room_reg_count");
public static final ResourceLocation NOT_A_MACHINE_BLOCK = new ResourceLocation(MOD_ID, "not_a_machine_block");

/**
* Shows a machine is not bound. Takes in a single param, the machine position in world.
*/
public static final ResourceLocation MACHINE_NOT_BOUND = new ResourceLocation(MOD_ID, "machine_not_bound");
public static final ResourceLocation REBIND_HAS_TUNNEL_CONNECTED = new ResourceLocation(MOD_ID, "rebind_tunnel_connected");

public static final ResourceLocation CMD_ROOM_NOT_REGISTERED = new ResourceLocation(MOD_ID, "room_not_registered");
public static final ResourceLocation CMD_MACHINE_NOT_REGISTERED = new ResourceLocation(MOD_ID, "machine_not_registered");
public static final ResourceLocation CMD_BAD_STATE = new ResourceLocation(MOD_ID, "incorrect_machine_state");
public static final ResourceLocation NO_PLAYER_HISTORY = new ResourceLocation(MOD_ID, "no_player_history");
public static final ResourceLocation WRONG_DIMENSION = new ResourceLocation(MOD_ID, "not_in_compact_dimension");
public static final ResourceLocation NOT_IN_COMPACT_DIMENSION = new ResourceLocation(MOD_ID, "not_in_compact_dim");
public static final ResourceLocation FAILED_CMD_FILE_ERROR = new ResourceLocation(MOD_ID, "failed_command_file_error");

public static final ResourceLocation CANNOT_GIVE_MACHINE = new ResourceLocation(MOD_ID, "cannot_give_machine_item");
public static final ResourceLocation MACHINE_GIVEN = new ResourceLocation(MOD_ID, "machine_given_successfully");
public static final ResourceLocation NO_REBIND_TUNNEL_PRESENT = new ResourceLocation(MOD_ID, "cannot_rebind_tunnel_present");
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public abstract class Tooltips {
public static final ResourceLocation UNKNOWN_PLAYER_NAME = new ResourceLocation(Constants.MOD_ID, "unknown_player");
public static final ResourceLocation TUNNEL_TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel_type");
public static final ResourceLocation UNKNOWN_TUNNEL_TYPE = new ResourceLocation(Constants.MOD_ID, "unknown_tunnel_type");
public static final ResourceLocation ROOM_NAME = new ResourceLocation(Constants.MOD_ID, "room_name");

public static abstract class Machines {
public static final ResourceLocation ID = new ResourceLocation(Constants.MOD_ID, "machine.id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

public interface IDimensionalPosition {

IDimensionalPosition relative(Direction direction, float amount);

BlockPos getBlockPosition();
Vec3 getExactPosition();

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

import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;

import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Optional;

public interface MachineRoomConnections {
@Nonnull
Optional<ChunkPos> getConnectedRoom(int machineId);
Optional<ChunkPos> getConnectedRoom(ResourceKey<Level> machineLevel, BlockPos machinePos);

@Nonnull Collection<Integer> getMachinesFor(ChunkPos chunkPos);

void registerMachine(int machine);
void registerMachine(ResourceKey<Level> machineLevel, BlockPos machinePos);

void registerRoom(ChunkPos roomChunk);

void connectMachineToRoom(int machine, ChunkPos room);
void changeMachineLink(int machine, ChunkPos newRoom);
void connectMachineToRoom(ResourceKey<Level> machineLevel, BlockPos machinePos, ChunkPos room);
void changeMachineLink(ResourceKey<Level> machineLevel, BlockPos machinePos, ChunkPos newRoom);

void disconnect(int machine);
void disconnect(ResourceKey<Level> level, BlockPos pos);

void unregisterRoom(ChunkPos room);
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package dev.compactmods.machines.api.room.history;

import dev.compactmods.machines.api.location.IDimensionalBlockPosition;
import dev.compactmods.machines.api.location.IDimensionalPosition;

public interface IRoomHistoryItem {

IDimensionalPosition getEntryLocation();

int getMachine();
IDimensionalBlockPosition getMachine();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import dev.compactmods.machines.CompactMachines;
import dev.compactmods.machines.advancement.trigger.ClaimedMachineTrigger;
import dev.compactmods.machines.advancement.trigger.BasicPlayerAdvTrigger;
import dev.compactmods.machines.advancement.trigger.HowDidYouGetHereTrigger;
import dev.compactmods.machines.api.core.Advancements;
import dev.compactmods.machines.core.Registration;
Expand Down Expand Up @@ -87,6 +87,17 @@ private void generateAdvancements(Consumer<Advancement> consumer) {
.build())
.save(consumer, Advancements.HOW_DID_YOU_GET_HERE.toString());

Advancement.Builder.advancement()
.parent(root)
.addCriterion("recursion", BasicPlayerAdvTrigger.Instance.create(Advancements.RECURSIVE_ROOMS))
.display(new DisplayBuilder()
.frame(FrameType.CHALLENGE)
.item(new ItemStack(Registration.PERSONAL_SHRINKING_DEVICE.get()))
.id(Advancements.RECURSIVE_ROOMS)
.toast(false).hidden(true)
.build())
.save(consumer, Advancements.RECURSIVE_ROOMS.toString());

Advancement.Builder.advancement()
.parent(root)
.addCriterion("obtained_wall", InventoryChangeTrigger.TriggerInstance.hasItems(Registration.BLOCK_BREAKABLE_WALL.get()))
Expand Down Expand Up @@ -118,7 +129,7 @@ private void generateAdvancements(Consumer<Advancement> consumer) {
private void machineAdvancement(Consumer<Advancement> consumer, Advancement root, ResourceLocation advancement, Supplier<Item> item) {
Advancement.Builder.advancement()
.parent(root)
.addCriterion("claimed_machine", ClaimedMachineTrigger.Instance.create(advancement))
.addCriterion("claimed_machine", BasicPlayerAdvTrigger.Instance.create(advancement))
.display(new DisplayBuilder()
.frame(FrameType.TASK)
.item(new ItemStack(item.get()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.mojang.datafixers.util.Pair;
import dev.compactmods.machines.api.machine.MachineNbt;
import dev.compactmods.machines.core.Registration;
import dev.compactmods.machines.room.data.CopyRoomBindingFunction;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.loot.BlockLoot;
import net.minecraft.data.loot.LootTableProvider;
Expand Down Expand Up @@ -66,16 +67,12 @@ protected void addTables() {
registerCompactMachineBlockDrops(Registration.MACHINE_BLOCK_MAXIMUM, Registration.MACHINE_BLOCK_ITEM_MAXIMUM);
}

private final LootItemFunction.Builder CopyOwnerAndReferenceFunction = CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY)
.copy(MachineNbt.OWNER, MachineNbt.OWNER)
.copy(MachineNbt.ID, MachineNbt.ID);

private void registerCompactMachineBlockDrops(RegistryObject<Block> block, RegistryObject<Item> item) {
LootPool.Builder builder = LootPool.lootPool()
.name(block.get().getRegistryName().toString())
.setRolls(ConstantValue.exactly(1))
.when(ExplosionCondition.survivesExplosion())
.apply(CopyOwnerAndReferenceFunction)
.apply(CopyRoomBindingFunction.binding())
.add(LootItem.lootTableItem(item.get()));

this.add(block.get(), LootTable.lootTable().withPool(builder));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ private void writeDimensions(HashMap<ResourceLocation, Biome> biomes, HashMap<Re

private void writeDimensionTypes(BiConsumer<DimensionType, ResourceLocation> consumer) {
final DimensionType dim = new DimensionTypeBuilder()
.ambientLight(15.0f)
.bedWorks(false)
.respawnAnchorWorks(false)
.fixedTime(18000L)
Expand Down
Loading

0 comments on commit 473d99e

Please sign in to comment.