Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BuildCraft API for 1.20.1 Forge #50

Open
wants to merge 4 commits into
base: 8.0.x-1.12.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

69 changes: 55 additions & 14 deletions api/buildcraft/api/BCBlocks.java
Original file line number Diff line number Diff line change
@@ -1,68 +1,109 @@
package buildcraft.api;

import net.minecraft.block.Block;

import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.registries.ObjectHolder;

public class BCBlocks {

@ObjectHolder("buildcraftcore")
public static class Core {
public static final Block SPRING = null;
public static final Block DECORATED = null;
public static final Block ENGINE = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:spring_water")
public static final Block SPRING_WATER = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:spring_oil")
public static final Block SPRING_OIL = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:decorated_destroy")
public static final Block DECORATED_DESTROY = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:decorated_blueprint")
public static final Block DECORATED_BLUEPRINT = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:decorated_template")
public static final Block DECORATED_TEMPLATE = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:decorated_paper")
public static final Block DECORATED_PAPER = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:decorated_leather")
public static final Block DECORATED_LEATHER = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:decorated_laser_back")
public static final Block DECORATED_LASER_BACK = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:engine_wood")
public static final Block ENGINE_WOOD = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:engine_stone")
public static final Block ENGINE_STONE = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:engine_iron")
public static final Block ENGINE_IRON = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:engine_creative")
public static final Block ENGINE_CREATIVE = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:marker_volume")
public static final Block MARKER_VOLUME = null;
@ObjectHolder(registryName = "block", value = "buildcraftcore:marker_path")
public static final Block MARKER_PATH = null;
}

@ObjectHolder("buildcraftbuilders")
public static class Builders {
@ObjectHolder(registryName = "block", value = "buildcraftbuilders:architect")
public static final Block ARCHITECT = null;
@ObjectHolder(registryName = "block", value = "buildcraftbuilders:builder")
public static final Block BUILDER = null;
@ObjectHolder(registryName = "block", value = "buildcraftbuilders:filler")
public static final Block FILLER = null;
@ObjectHolder(registryName = "block", value = "buildcraftbuilders:library")
public static final Block LIBRARY = null;
@ObjectHolder(registryName = "block", value = "buildcraftbuilders:replacer")
public static final Block REPLACER = null;
@ObjectHolder(registryName = "block", value = "buildcraftbuilders:quarry")
public static final Block QUARRY = null;
@ObjectHolder(registryName = "block", value = "buildcraftbuilders:frame")
public static final Block FRAME = null;
}

@ObjectHolder("buildcraftenergy")
public static class Energy {
// Fluid blocks can be accessed ~somewhere else~
// @ObjectHolder(registryName = "block", value = "buildcraftenergy:")
}

@ObjectHolder("buildcraftfactory")
public static class Factory {
@ObjectHolder(registryName = "block", value = "buildcraftfactory:autoworkbench_item")
public static final Block AUTOWORKBENCH_ITEM = null;
@ObjectHolder(registryName = "block", value = "buildcraftfactory:mining_well")
public static final Block MINING_WELL = null;
@ObjectHolder(registryName = "block", value = "buildcraftfactory:pump")
public static final Block PUMP = null;
@ObjectHolder(registryName = "block", value = "buildcraftfactory:tube")
public static final Block TUBE = null;
@ObjectHolder(registryName = "block", value = "buildcraftfactory:flood_gate")
public static final Block FLOOD_GATE = null;
@ObjectHolder(registryName = "block", value = "buildcraftfactory:tank")
public static final Block TANK = null;
@ObjectHolder(registryName = "block", value = "buildcraftfactory:chute")
public static final Block CHUTE = null;
@ObjectHolder(registryName = "block", value = "buildcraftfactory:water_gel")
public static final Block WATER_GEL = null;
@ObjectHolder(registryName = "block", value = "buildcraftfactory:distiller")
public static final Block DISTILLER = null;
@ObjectHolder(registryName = "block", value = "buildcraftfactory:heat_exchange")
public static final Block HEAT_EXCHANGE = null;
}

@ObjectHolder("buildcrafttransport")
public static class Transport {
@ObjectHolder(registryName = "block", value = "buildcrafttransport:filtered_buffer")
public static final Block FILTERED_BUFFER = null;
@ObjectHolder(registryName = "block", value = "buildcrafttransport:pipe_holder")
public static final Block PIPE_HOLDER = null;
}

@ObjectHolder("buildcraftsilicon")
public static class Silicon {
@ObjectHolder(registryName = "block", value = "buildcraftsilicon:laser")
public static final Block LASER = null;
@ObjectHolder(registryName = "block", value = "buildcraftsilicon:assembly_table")
public static final Block ASSEMBLY_TABLE = null;
@ObjectHolder(registryName = "block", value = "buildcraftsilicon:advanced_crafting_table")
public static final Block ADVANCED_CRAFTING_TABLE = null;
@ObjectHolder(registryName = "block", value = "buildcraftsilicon:integration_table")
public static final Block INTEGRATION_TABLE = null;
@ObjectHolder(registryName = "block", value = "buildcraftsilicon:charging_table")
public static final Block CHARGING_TABLE = null;
@ObjectHolder(registryName = "block", value = "buildcraftsilicon:programming_table")
public static final Block PROGRAMMING_TABLE = null;
}

@ObjectHolder("buildcraftrobotics")
public static class Robotics {

// @ObjectHolder(registryName = "block", value = "buildcraftrobotics:")
}
}
88 changes: 60 additions & 28 deletions api/buildcraft/api/BCItems.java
Original file line number Diff line number Diff line change
@@ -1,79 +1,111 @@
package buildcraft.api;

import net.minecraft.item.Item;

import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;

import buildcraft.api.items.FluidItemDrops;
import net.minecraft.world.item.Item;
import net.minecraftforge.registries.ObjectHolder;

public class BCItems {

@ObjectHolder("buildcraftlib")
public static class Lib {
@ObjectHolder(registryName = "item", value = "buildcraftlib:guide")
public static final Item GUIDE = null;
@ObjectHolder(registryName = "item", value = "buildcraftlib:guide_note")
public static final Item GUIDE_NOTE = null;
@ObjectHolder(registryName = "item", value = "buildcraftlib:debugger")
public static final Item DEBUGGER = null;
}

@ObjectHolder("buildcraftcore")
public static class Core {
@ObjectHolder(registryName = "item", value = "buildcraftcore:gear_wood")
public static final Item GEAR_WOOD = null;
@ObjectHolder(registryName = "item", value = "buildcraftcore:gear_stone")
public static final Item GEAR_STONE = null;
@ObjectHolder(registryName = "item", value = "buildcraftcore:gear_iron")
public static final Item GEAR_IRON = null;
@ObjectHolder(registryName = "item", value = "buildcraftcore:gear_gold")
public static final Item GEAR_GOLD = null;
@ObjectHolder(registryName = "item", value = "buildcraftcore:gear_diamond")
public static final Item GEAR_DIAMOND = null;
@ObjectHolder(registryName = "item", value = "buildcraftcore:wrench")
public static final Item WRENCH = null;
public static final Item PAINTBRUSH = null;
@ObjectHolder(registryName = "item", value = "buildcraftcore:paintbrush_clean")
public static final Item PAINTBRUSH_CLEAN = null;
@ObjectHolder(registryName = "item", value = "buildcraftcore:list")
public static final Item LIST = null;
@ObjectHolder(registryName = "item", value = "buildcraftcore:map_location")
public static final Item MAP_LOCATION = null;
@ObjectHolder(registryName = "item", value = "buildcraftcore:marker_connector")
public static final Item MARKER_CONNECTOR = null;
@ObjectHolder(registryName = "item", value = "buildcraftcore:volume_box")
public static final Item VOLUME_BOX = null;
@ObjectHolder(registryName = "item", value = "buildcraftcore:goggles")
public static final Item GOGGLES = null;

/** It is recommended that you refer to {@link FluidItemDrops#item} when creating fluid drops rather than
* this. */
/**
* It is recommended that you refer to {@link FluidItemDrops#item} when creating fluid drops rather than
* this.
*/
@ObjectHolder(registryName = "item", value = "buildcraftcore:fragile_fluid_shard")
public static final Item FRAGILE_FLUID_SHARD = null;
}

@ObjectHolder("buildcraftbuilders")
public static class Builders {

// @ObjectHolder(registryName = "item", value = "buildcraftbuilders:")
}

@ObjectHolder("buildcraftenergy")
public static class Energy {
public static final Item GLOB_OF_OIL = null;
@ObjectHolder(registryName = "item", value = "buildcraftenergy:glob_oil")
public static final Item GLOB_OIL = null;
}

@ObjectHolder("buildcraftfactory")
public static class Factory {
@ObjectHolder(registryName = "item", value = "buildcraftfactory:plastic_sheet")
public static final Item PLASTIC_SHEET = null;
public static final Item WATER_GEL = null;
public static final Item GELLED_WATER = null;
@ObjectHolder(registryName = "item", value = "buildcraftfactory:water_gel_spawn")
public static final Item WATER_GEL_SPAWN = null;
@ObjectHolder(registryName = "item", value = "buildcraftfactory:gel")
public static final Item GEL = null;
}

@ObjectHolder("buildcrafttransport")
public static class Transport {
@ObjectHolder(registryName = "item", value = "buildcrafttransport:plug_blocker")
public static final Item PLUG_BLOCKER = null;
@ObjectHolder(registryName = "item", value = "buildcrafttransport:plug_power_adaptor")
public static final Item PLUG_POWER_ADAPTOR = null;

public static final Item PIPE_STRUCTURE = null;
public static final Item PIPE_WOOD_ITEM = null;
public static final Item PIPE_EMZULI_ITEM = null;
public static final Item PIPE_DIAMOND_WOOD_ITEM = null;
public static final Item PIPE_WOOD_FLUID = null;
public static final Item PIPE_DIAMOND_WOOD_FLUID = null;
@ObjectHolder(registryName = "item", value = "buildcrafttransport:pipe_structure_cobblestone_colorless")
public static final Item PIPE_STRUCTURE_COBBLESTONE_COLORLESS = null;
@ObjectHolder(registryName = "item", value = "buildcrafttransport:pipe_items_wood_colorless")
public static final Item PIPE_ITEMS_WOOD_COLORLESS = null;
@ObjectHolder(registryName = "item", value = "buildcrafttransport:pipe_items_emzuli_colorless")
public static final Item PIPE_ITEMS_EMZULI_COLORLESS = null;
@ObjectHolder(registryName = "item", value = "buildcrafttransport:pipe_items_diamond_wood_colorless")
public static final Item PIPE_ITEMS_DIAMOND_WOOD_COLORLESS = null;
@ObjectHolder(registryName = "item", value = "buildcrafttransport:pipe_fluids_wood_colorless")
public static final Item PIPE_FLUIDS_WOOD_COLORLESS = null;
@ObjectHolder(registryName = "item", value = "buildcrafttransport:pipe_fluids_diamond_wood_colorless")
public static final Item PIPE_FLUIDS_DIAMOND_WOOD_COLORLESS = null;
}

@ObjectHolder("buildcraftsilicon")
public static class Silicon {
public static final Item REDSTONE_CHIPSET = null;

@ObjectHolder(registryName = "item", value = "buildcraftsilicon:chipset_redstone")
public static final Item CHIPSET_REDSTONE = null;
@ObjectHolder(registryName = "item", value = "buildcraftsilicon:chipset_iron")
public static final Item CHIPSET_IRON = null;
@ObjectHolder(registryName = "item", value = "buildcraftsilicon:chipset_gold")
public static final Item CHIPSET_GOLD = null;
@ObjectHolder(registryName = "item", value = "buildcraftsilicon:chipset_quartz")
public static final Item CHIPSET_QUARTZ = null;
@ObjectHolder(registryName = "item", value = "buildcraftsilicon:chipset_diamond")
public static final Item CHIPSET_DIAMOND = null;

@ObjectHolder(registryName = "item", value = "buildcraftsilicon:plug_pulsar")
public static final Item PLUG_PULSAR = null;
@ObjectHolder(registryName = "item", value = "buildcraftsilicon:plug_facade")
public static final Item PLUG_FACADE = null;
}

@ObjectHolder("buildcraftrobotics")
public static class Robotics {

// @ObjectHolder(registryName = "item", value = "buildcraftrobotics:")
}
}
32 changes: 19 additions & 13 deletions api/buildcraft/api/BCModules.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package buildcraft.api;

import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.ModLoadingStage;

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import javax.annotation.Nullable;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.util.ResourceLocation;

import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.LoaderState;

public enum BCModules implements IBuildCraftMod {
LIB,
// Base module for all BC.
Expand All @@ -30,10 +29,14 @@ public enum BCModules implements IBuildCraftMod {
private static boolean hasChecked = false;
private static BCModules[] loadedModules, missingModules;

// Calen
public static final String BUILDCRAFT = "buildcraft";

public final String lowerCaseName = name().toLowerCase(Locale.ROOT);
// Bit hacky, but it works as this is all english
public final String camelCaseName = name().charAt(0) + lowerCaseName.substring(1);
private final String modId = "buildcraft" + lowerCaseName;
// private final String modId = "buildcraft" + lowerCaseName;
private final String modId = BUILDCRAFT + lowerCaseName;
private boolean loaded;

private static void checkLoadStatus() {
Expand All @@ -48,12 +51,14 @@ private static synchronized void load0() {
if (hasChecked) {
return;
}
if (!Loader.instance().hasReachedState(LoaderState.PREINITIALIZATION)) {
// if (!Loader.instance().hasReachedState(LoaderState.PREINITIALIZATION))
if (ModLoadingContext.get().getActiveContainer().getCurrentState().ordinal() < ModLoadingStage.CONSTRUCT.ordinal()) {
throw new RuntimeException("You can only use BCModules.isLoaded from pre-init onwards!");
}
List<BCModules> found = new ArrayList<>(), missing = new ArrayList<>();
for (BCModules module : VALUES) {
module.loaded = Loader.isModLoaded(module.modId);
module.loaded = ModList.get().isLoaded(module.modId);

if (module.loaded) {
found.add(module);
} else {
Expand Down Expand Up @@ -104,10 +109,11 @@ public ResourceLocation createLocation(String path) {
}

public ModelResourceLocation createModelLocation(String path, String variant) {
return new ModelResourceLocation(getModId() + ":" + path + "#" + variant);
return new ModelResourceLocation(getModId(), path, variant);
}

public ModelResourceLocation createModelLocation(String pathAndVariant) {
return new ModelResourceLocation(getModId() + ":" + pathAndVariant);
String[] pathAndVariantArray = pathAndVariant.split("#");
return new ModelResourceLocation(getModId(), pathAndVariantArray[0], pathAndVariantArray[1]);
}
}
Loading