From ccadac2d9617af418708a051c1b45847b9bb73fa Mon Sep 17 00:00:00 2001 From: LRW-Calen <135932489+LRW-Calen@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:06:14 +0800 Subject: [PATCH 01/20] API for forge 1.18.2 --- .travis.yml | 16 - api/buildcraft/api/BCBlocks.java | 68 ---- api/buildcraft/api/BCItems.java | 79 ----- api/buildcraft/api/BCModules.java | 93 ++++-- api/buildcraft/api/IBuildCraftMod.java | 3 +- .../api/blocks/CustomPaintHelper.java | 147 +++++---- .../api/blocks/CustomRotationHelper.java | 46 +-- .../api/blocks/ICustomPaintHandler.java | 45 +-- .../api/blocks/ICustomRotationHandler.java | 15 +- api/buildcraft/api/blocks/package-info.java | 3 +- .../api/boards/RedstoneBoardNBT.java | 25 +- .../api/boards/RedstoneBoardRegistry.java | 7 +- .../api/boards/RedstoneBoardRobotNBT.java | 7 +- api/buildcraft/api/boards/package-info.java | 3 +- api/buildcraft/api/core/AreaProviders.java | 24 -- api/buildcraft/api/core/BCDebugging.java | 19 +- api/buildcraft/api/core/BCLog.java | 3 +- api/buildcraft/api/core/BuildCraftAPI.java | 66 ++-- .../api/core/CapabilitiesHelper.java | 307 ++++++++++-------- api/buildcraft/api/core/EnumColor.java | 147 --------- api/buildcraft/api/core/EnumPipePart.java | 67 ++-- api/buildcraft/api/core/EnumWireColour.java | 69 ---- api/buildcraft/api/core/IAreaProvider.java | 6 +- api/buildcraft/api/core/IBox.java | 4 +- api/buildcraft/api/core/IConvertable.java | 3 +- api/buildcraft/api/core/IEngineType.java | 3 +- .../api/core/IFakePlayerProvider.java | 17 +- api/buildcraft/api/core/IFluidFilter.java | 3 +- api/buildcraft/api/core/IFluidHandlerAdv.java | 23 +- api/buildcraft/api/core/IInvSlot.java | 26 -- api/buildcraft/api/core/IPathProvider.java | 10 +- api/buildcraft/api/core/IPlayerOwned.java | 3 +- api/buildcraft/api/core/IStackFilter.java | 9 +- api/buildcraft/api/core/IWorldProperty.java | 9 +- api/buildcraft/api/core/IZone.java | 15 +- api/buildcraft/api/core/JavaTools.java | 39 --- api/buildcraft/api/core/SafeTimeTracker.java | 15 +- api/buildcraft/api/core/StackKey.java | 124 ------- api/buildcraft/api/core/package-info.java | 3 +- api/buildcraft/api/core/render/ISprite.java | 3 +- api/buildcraft/api/crops/CropManager.java | 26 +- api/buildcraft/api/crops/ICropHandler.java | 28 +- api/buildcraft/api/crops/package-info.java | 4 +- .../api/data/NbtSquishConstants.java | 9 +- .../api/enums/EnumDecoratedBlock.java | 9 +- api/buildcraft/api/enums/EnumEngineType.java | 66 +++- .../api/enums/EnumExchangePart.java | 20 ++ .../api/enums/EnumLaserTableType.java | 7 +- .../api/enums/EnumMachineState.java | 12 +- .../api/enums/EnumOptionalSnapshotType.java | 9 +- api/buildcraft/api/enums/EnumPowerStage.java | 9 +- .../api/enums/EnumRedstoneChipset.java | 73 +++-- api/buildcraft/api/enums/EnumSpring.java | 35 +- api/buildcraft/api/enums/package-info.java | 3 +- .../api/events/BlockInteractionEvent.java | 17 +- .../api/events/BlockPlacedDownEvent.java | 20 +- .../api/events/PipePlacedEvent.java | 16 +- api/buildcraft/api/events/RobotEvent.java | 25 +- .../api/events/RobotPlacementEvent.java | 14 +- api/buildcraft/api/events/package-info.java | 3 +- api/buildcraft/api/facades/FacadeAPI.java | 52 +-- api/buildcraft/api/facades/IFacadeItem.java | 8 +- .../api/facades/IFacadePhasedState.java | 6 +- .../api/facades/IFacadeRegistry.java | 7 +- api/buildcraft/api/facades/IFacadeState.java | 6 +- api/buildcraft/api/facades/package-info.java | 5 +- .../api/filler/IFilledTemplate.java | 6 +- api/buildcraft/api/filler/IFillerPattern.java | 7 +- .../api/filler/IFillerPatternShape.java | 9 +- .../api/filler/IFillerRegistry.java | 8 +- api/buildcraft/api/filler/package-info.java | 3 +- api/buildcraft/api/fuels/EnumCoolantType.java | 21 ++ api/buildcraft/api/fuels/ICoolant.java | 69 +++- api/buildcraft/api/fuels/ICoolantManager.java | 56 ++-- api/buildcraft/api/fuels/IFluidCoolant.java | 23 ++ api/buildcraft/api/fuels/IFuel.java | 72 +++- api/buildcraft/api/fuels/IFuelManager.java | 66 ++-- api/buildcraft/api/fuels/ISolidCoolant.java | 19 +- api/buildcraft/api/fuels/package-info.java | 3 +- api/buildcraft/api/gates/IGate.java | 4 +- api/buildcraft/api/gates/package-info.java | 3 +- api/buildcraft/api/imc/BcImcMessage.java | 41 +++ .../api/inventory/IItemHandlerFiltered.java | 3 +- .../api/inventory/IItemTransactor.java | 9 +- api/buildcraft/api/items/FluidItemDrops.java | 17 +- .../api/items/IItemCustomPipeRender.java | 14 - api/buildcraft/api/items/IItemFluidShard.java | 12 +- api/buildcraft/api/items/IList.java | 4 +- api/buildcraft/api/items/IMapLocation.java | 20 +- api/buildcraft/api/items/INamedItem.java | 11 +- api/buildcraft/api/items/package-info.java | 3 +- .../api/library/ILibraryTypeHandler.java | 18 - api/buildcraft/api/library/LibraryAPI.java | 30 -- .../api/library/LibraryTypeHandler.java | 31 -- .../library/LibraryTypeHandlerByteArray.java | 13 - .../api/library/LibraryTypeHandlerNBT.java | 14 - api/buildcraft/api/library/package-info.java | 8 - .../api/lists/ListMatchHandler.java | 6 +- api/buildcraft/api/lists/ListRegistry.java | 4 +- api/buildcraft/api/lists/package-info.java | 3 +- api/buildcraft/api/mj/ILaserTarget.java | 6 +- api/buildcraft/api/mj/ILaserTargetBlock.java | 3 +- api/buildcraft/api/mj/IMjConnector.java | 5 +- api/buildcraft/api/mj/IMjEffectManager.java | 15 +- api/buildcraft/api/mj/MjAPI.java | 138 ++++++-- api/buildcraft/api/mj/MjBattery.java | 32 +- api/buildcraft/api/mj/MjCapabilityHelper.java | 66 ++-- api/buildcraft/api/power/IEngine.java | 4 +- api/buildcraft/api/power/package-info.java | 3 +- .../api/properties/BuildCraftProperties.java | 138 ++++---- .../api/recipes/AssemblyRecipe.java | 96 +++++- .../api/recipes/AssemblyRecipeBasic.java | 86 +++-- .../api/recipes/AssemblyRecipeType.java | 8 + .../api/recipes/BuildcraftRecipeRegistry.java | 3 +- .../recipes/IIntegrationRecipeProvider.java | 8 +- .../api/recipes/IRefineryRecipeManager.java | 134 ++++++-- .../api/recipes/IngredientStack.java | 50 ++- .../api/recipes/IntegrationRecipe.java | 9 +- .../api/recipes/StackDefinition.java | 4 +- api/buildcraft/api/recipes/package-info.java | 3 +- .../registry/BuildCraftRegistryManager.java | 3 +- .../api/registry/EventBuildCraftReload.java | 18 +- .../api/registry/IReloadableRegistry.java | 4 +- .../registry/IReloadableRegistryManager.java | 7 +- .../api/registry/IScriptableRegistry.java | 12 +- api/buildcraft/api/robots/AIRobot.java | 35 +- api/buildcraft/api/robots/DockingStation.java | 52 ++- .../api/robots/EntityRobotBase.java | 26 +- .../api/robots/IRequestProvider.java | 2 +- .../api/robots/IRobotOverlayItem.java | 9 +- api/buildcraft/api/robots/IRobotRegistry.java | 14 +- .../api/robots/IRobotRegistryProvider.java | 4 +- api/buildcraft/api/robots/ResourceId.java | 12 +- .../api/robots/ResourceIdBlock.java | 24 +- .../api/robots/ResourceIdRequest.java | 14 +- api/buildcraft/api/robots/RobotManager.java | 4 +- api/buildcraft/api/robots/package-info.java | 3 +- .../api/schematics/ISchematicBlock.java | 40 +-- .../api/schematics/ISchematicEntity.java | 38 +-- .../api/schematics/SchematicBlockContext.java | 21 +- .../api/schematics/SchematicBlockFactory.java | 7 +- .../SchematicBlockFactoryRegistry.java | 40 ++- .../schematics/SchematicEntityContext.java | 15 +- .../schematics/SchematicEntityFactory.java | 7 +- .../SchematicEntityFactoryRegistry.java | 43 ++- .../api/statements/IActionExternal.java | 6 +- .../api/statements/IActionInternalSided.java | 4 +- .../api/statements/IActionProvider.java | 14 +- .../api/statements/IActionReceptor.java | 3 +- api/buildcraft/api/statements/IGuiSlot.java | 78 +++-- .../IOverrideDefaultStatements.java | 3 +- .../api/statements/IStatementContainer.java | 13 +- .../api/statements/IStatementParameter.java | 25 +- .../api/statements/ITriggerExternal.java | 6 +- .../statements/ITriggerExternalOverride.java | 7 +- .../api/statements/ITriggerInternalSided.java | 4 +- .../api/statements/ITriggerProvider.java | 16 +- .../api/statements/StatementManager.java | 52 +-- .../api/statements/StatementMouseClick.java | 3 +- .../StatementParameterItemStack.java | 172 ++++++---- .../api/statements/StatementSlot.java | 8 +- .../containers/IFillerStatementContainer.java | 13 +- .../IRedstoneStatementContainer.java | 9 +- .../containers/ISidedStatementContainer.java | 5 +- .../api/statements/package-info.java | 3 +- .../api/template/ITemplateHandler.java | 10 +- .../api/template/ITemplateRegistry.java | 11 +- api/buildcraft/api/tiles/IControllable.java | 3 +- api/buildcraft/api/tiles/IDebuggable.java | 36 +- api/buildcraft/api/tiles/IHasWork.java | 3 +- api/buildcraft/api/tiles/IHeatable.java | 3 +- .../api/tiles/ITileAreaProvider.java | 5 +- api/buildcraft/api/tiles/TilesAPI.java | 53 ++- api/buildcraft/api/tiles/package-info.java | 3 +- api/buildcraft/api/tools/IToolWrench.java | 15 +- api/buildcraft/api/tools/package-info.java | 3 +- .../api/transport/EnumWirePart.java | 88 +++-- api/buildcraft/api/transport/IInjectable.java | 16 +- .../api/transport/IItemPluggable.java | 22 +- .../api/transport/IStripesActivator.java | 10 +- .../api/transport/IStripesHandlerBlock.java | 12 +- .../api/transport/IStripesHandlerItem.java | 18 +- .../api/transport/IStripesRegistry.java | 25 +- .../api/transport/IWireEmitter.java | 9 +- .../api/transport/IWireManager.java | 16 +- api/buildcraft/api/transport/WireNode.java | 27 +- .../api/transport/package-info.java | 3 +- .../transport/pipe/EnumPipeColourType.java | 3 +- .../transport/pipe/ICustomPipeConnection.java | 13 +- .../api/transport/pipe/IFlowFluid.java | 93 +++--- .../api/transport/pipe/IFlowItems.java | 21 +- .../api/transport/pipe/IFlowPower.java | 5 +- .../api/transport/pipe/IItemPipe.java | 11 +- api/buildcraft/api/transport/pipe/IPipe.java | 19 +- .../transport/pipe/IPipeBehaviourBaker.java | 4 +- .../pipe/IPipeBehaviourRenderer.java | 15 +- .../api/transport/pipe/IPipeConnection.java | 4 +- .../transport/pipe/IPipeExtensionManager.java | 15 +- .../api/transport/pipe/IPipeFlowBaker.java | 4 +- .../api/transport/pipe/IPipeFlowRenderer.java | 6 +- .../api/transport/pipe/IPipeHolder.java | 148 ++++++--- .../api/transport/pipe/IPipeRegistry.java | 52 +-- .../api/transport/pipe/PipeApi.java | 53 +-- .../api/transport/pipe/PipeApiClient.java | 7 +- .../api/transport/pipe/PipeBehaviour.java | 75 +++-- .../api/transport/pipe/PipeConnectionAPI.java | 19 +- .../api/transport/pipe/PipeDefinition.java | 28 +- .../api/transport/pipe/PipeEvent.java | 3 +- .../pipe/PipeEventConnectionChange.java | 8 +- .../api/transport/pipe/PipeEventFluid.java | 56 ++-- .../api/transport/pipe/PipeEventItem.java | 145 ++++----- .../api/transport/pipe/PipeEventPower.java | 11 +- .../transport/pipe/PipeEventStatement.java | 18 +- .../transport/pipe/PipeEventTileState.java | 8 +- .../api/transport/pipe/PipeFaceTex.java | 3 +- .../api/transport/pipe/PipeFlow.java | 123 ++++--- .../api/transport/pipe/PipeFlowType.java | 7 +- .../pluggable/IPlugDynamicRenderer.java | 6 +- .../pluggable/IPluggableRegistry.java | 2 +- .../pluggable/IPluggableStaticBaker.java | 9 +- .../transport/pluggable/PipePluggable.java | 225 ++++++++----- .../pluggable/PluggableDefinition.java | 38 +-- .../pluggable/PluggableModelKey.java | 17 +- build.gradle | 285 ++++++++++++---- build.properties | 7 +- gradle/wrapper/gradle-wrapper.jar | Bin 52271 -> 59821 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 294 ++++++++++------- gradlew.bat | 53 ++- 229 files changed, 3684 insertions(+), 3025 deletions(-) delete mode 100644 .travis.yml delete mode 100644 api/buildcraft/api/BCBlocks.java delete mode 100644 api/buildcraft/api/BCItems.java delete mode 100644 api/buildcraft/api/core/AreaProviders.java delete mode 100644 api/buildcraft/api/core/EnumColor.java delete mode 100644 api/buildcraft/api/core/EnumWireColour.java delete mode 100644 api/buildcraft/api/core/IInvSlot.java delete mode 100755 api/buildcraft/api/core/JavaTools.java delete mode 100644 api/buildcraft/api/core/StackKey.java create mode 100644 api/buildcraft/api/enums/EnumExchangePart.java create mode 100644 api/buildcraft/api/fuels/EnumCoolantType.java create mode 100644 api/buildcraft/api/fuels/IFluidCoolant.java create mode 100644 api/buildcraft/api/imc/BcImcMessage.java delete mode 100644 api/buildcraft/api/items/IItemCustomPipeRender.java delete mode 100644 api/buildcraft/api/library/ILibraryTypeHandler.java delete mode 100644 api/buildcraft/api/library/LibraryAPI.java delete mode 100644 api/buildcraft/api/library/LibraryTypeHandler.java delete mode 100644 api/buildcraft/api/library/LibraryTypeHandlerByteArray.java delete mode 100644 api/buildcraft/api/library/LibraryTypeHandlerNBT.java delete mode 100644 api/buildcraft/api/library/package-info.java create mode 100644 api/buildcraft/api/recipes/AssemblyRecipeType.java diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0b89a53..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: java -jdk: - - openjdk8 - -jobs: - include: - - stage: build - install: ./gradlew setupCiWorkspace -S - script: ./gradlew build - - stage: checkstyle - install: echo "skipping default ./gradlew assemble" - script: ./gradlew checkstyle - -env: - global: - TERM=dumb diff --git a/api/buildcraft/api/BCBlocks.java b/api/buildcraft/api/BCBlocks.java deleted file mode 100644 index 693aa4e..0000000 --- a/api/buildcraft/api/BCBlocks.java +++ /dev/null @@ -1,68 +0,0 @@ -package buildcraft.api; - -import net.minecraft.block.Block; - -import net.minecraftforge.fml.common.registry.GameRegistry.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; - public static final Block MARKER_VOLUME = null; - public static final Block MARKER_PATH = null; - } - - @ObjectHolder("buildcraftbuilders") - public static class Builders { - public static final Block ARCHITECT = null; - public static final Block BUILDER = null; - public static final Block FILLER = null; - public static final Block LIBRARY = null; - public static final Block REPLACER = null; - public static final Block QUARRY = null; - public static final Block FRAME = null; - } - - @ObjectHolder("buildcraftenergy") - public static class Energy { - // Fluid blocks can be accessed ~somewhere else~ - } - - @ObjectHolder("buildcraftfactory") - public static class Factory { - public static final Block AUTOWORKBENCH_ITEM = null; - public static final Block MINING_WELL = null; - public static final Block PUMP = null; - public static final Block TUBE = null; - public static final Block FLOOD_GATE = null; - public static final Block TANK = null; - public static final Block CHUTE = null; - public static final Block WATER_GEL = null; - public static final Block DISTILLER = null; - public static final Block HEAT_EXCHANGE = null; - } - - @ObjectHolder("buildcrafttransport") - public static class Transport { - public static final Block FILTERED_BUFFER = null; - public static final Block PIPE_HOLDER = null; - } - - @ObjectHolder("buildcraftsilicon") - public static class Silicon { - public static final Block LASER = null; - public static final Block ASSEMBLY_TABLE = null; - public static final Block ADVANCED_CRAFTING_TABLE = null; - public static final Block INTEGRATION_TABLE = null; - public static final Block CHARGING_TABLE = null; - public static final Block PROGRAMMING_TABLE = null; - } - - @ObjectHolder("buildcraftrobotics") - public static class Robotics { - - } -} diff --git a/api/buildcraft/api/BCItems.java b/api/buildcraft/api/BCItems.java deleted file mode 100644 index 01f5446..0000000 --- a/api/buildcraft/api/BCItems.java +++ /dev/null @@ -1,79 +0,0 @@ -package buildcraft.api; - -import net.minecraft.item.Item; - -import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; - -import buildcraft.api.items.FluidItemDrops; - -public class BCItems { - - @ObjectHolder("buildcraftlib") - public static class Lib { - public static final Item GUIDE = null; - public static final Item GUIDE_NOTE = null; - public static final Item DEBUGGER = null; - } - - @ObjectHolder("buildcraftcore") - public static class Core { - public static final Item GEAR_WOOD = null; - public static final Item GEAR_STONE = null; - public static final Item GEAR_IRON = null; - public static final Item GEAR_GOLD = null; - public static final Item GEAR_DIAMOND = null; - public static final Item WRENCH = null; - public static final Item PAINTBRUSH = null; - public static final Item LIST = null; - public static final Item MAP_LOCATION = null; - public static final Item MARKER_CONNECTOR = null; - public static final Item VOLUME_BOX = null; - public static final Item GOGGLES = null; - - /** It is recommended that you refer to {@link FluidItemDrops#item} when creating fluid drops rather than - * this. */ - public static final Item FRAGILE_FLUID_SHARD = null; - } - - @ObjectHolder("buildcraftbuilders") - public static class Builders { - - } - - @ObjectHolder("buildcraftenergy") - public static class Energy { - public static final Item GLOB_OF_OIL = null; - } - - @ObjectHolder("buildcraftfactory") - public static class Factory { - public static final Item PLASTIC_SHEET = null; - public static final Item WATER_GEL = null; - public static final Item GELLED_WATER = null; - } - - @ObjectHolder("buildcrafttransport") - public static class Transport { - public static final Item PLUG_BLOCKER = null; - 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("buildcraftsilicon") - public static class Silicon { - public static final Item REDSTONE_CHIPSET = null; - - public static final Item PLUG_PULSAR = null; - } - - @ObjectHolder("buildcraftrobotics") - public static class Robotics { - - } -} diff --git a/api/buildcraft/api/BCModules.java b/api/buildcraft/api/BCModules.java index bb9cf30..e48167a 100644 --- a/api/buildcraft/api/BCModules.java +++ b/api/buildcraft/api/BCModules.java @@ -1,18 +1,16 @@ package buildcraft.api; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.fml.ModList; + +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 { +public enum BCModules implements IBuildCraftMod +{ LIB, // Base module for all BC. CORE, @@ -30,33 +28,51 @@ 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() { - if (hasChecked) { + private static void checkLoadStatus() + { + if (hasChecked) + { return; } load0(); } - /** Performs the actual loading of {@link #checkLoadStatus()}, except this is thread safe. */ - private static synchronized void load0() { - if (hasChecked) { + /** + * Performs the actual loading of {@link #checkLoadStatus()}, except this is thread safe. + */ + private static synchronized void load0() + { + if (hasChecked) + { return; } - if (!Loader.instance().hasReachedState(LoaderState.PREINITIALIZATION)) { - throw new RuntimeException("You can only use BCModules.isLoaded from pre-init onwards!"); - } + // Calen: loading events order is changed from 1.12.2 to 1.18.2... +// 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 found = new ArrayList<>(), missing = new ArrayList<>(); - for (BCModules module : VALUES) { - module.loaded = Loader.isModLoaded(module.modId); - if (module.loaded) { + for (BCModules module : VALUES) + { + module.loaded = ModList.get().isLoaded(module.modId); + + if (module.loaded) + { found.add(module); - } else { + } + else + { missing.add(module); } } @@ -66,48 +82,59 @@ private static synchronized void load0() { } @Nullable - public static BCModules getBcMod(String testModId) { - for (BCModules mod : VALUES) { - if (mod.modId.equals(testModId)) { + public static BCModules getBcMod(String testModId) + { + for (BCModules mod : VALUES) + { + if (mod.modId.equals(testModId)) + { return mod; } } return null; } - public static boolean isBcMod(String testModId) { + public static boolean isBcMod(String testModId) + { return getBcMod(testModId) != null; } - public static BCModules[] getLoadedModules() { + public static BCModules[] getLoadedModules() + { checkLoadStatus(); return loadedModules; } - public static BCModules[] getMissingModules() { + public static BCModules[] getMissingModules() + { checkLoadStatus(); return missingModules; } @Override - public String getModId() { + public String getModId() + { return modId; } - public boolean isLoaded() { + public boolean isLoaded() + { checkLoadStatus(); return loaded; } - public ResourceLocation createLocation(String path) { + public ResourceLocation createLocation(String path) + { return new ResourceLocation(getModId(), path); } - public ModelResourceLocation createModelLocation(String path, String variant) { + public ModelResourceLocation createModelLocation(String path, String variant) + { return new ModelResourceLocation(getModId() + ":" + path + "#" + variant); } - public ModelResourceLocation createModelLocation(String pathAndVariant) { + public ModelResourceLocation createModelLocation(String pathAndVariant) + { return new ModelResourceLocation(getModId() + ":" + pathAndVariant); } } diff --git a/api/buildcraft/api/IBuildCraftMod.java b/api/buildcraft/api/IBuildCraftMod.java index b528ed4..632df64 100644 --- a/api/buildcraft/api/IBuildCraftMod.java +++ b/api/buildcraft/api/IBuildCraftMod.java @@ -1,7 +1,8 @@ package buildcraft.api; /** Allows a mod (or addon) to register networking packets in the message manager. */ -public interface IBuildCraftMod { +public interface IBuildCraftMod +{ /** @return The modid to use when registering this as a channel. */ String getModId(); } diff --git a/api/buildcraft/api/blocks/CustomPaintHelper.java b/api/buildcraft/api/blocks/CustomPaintHelper.java index 2517af2..4fa536c 100644 --- a/api/buildcraft/api/blocks/CustomPaintHelper.java +++ b/api/buildcraft/api/blocks/CustomPaintHelper.java @@ -1,28 +1,30 @@ package buildcraft.api.blocks; -import java.util.List; -import java.util.Map; - -import javax.annotation.Nullable; - +import buildcraft.api.core.BCLog; +import buildcraft.api.core.BCDebugging; +import buildcraft.lib.misc.BlockUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.registries.ForgeRegistries; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - -import buildcraft.api.core.BCDebugging; -import buildcraft.api.core.BCLog; +import javax.annotation.Nullable; +import java.util.List; +import java.util.Map; -/** Provides a simple way to paint a single block, iterating through all {@link ICustomPaintHandler}'s that are - * registered for the block. */ -public enum CustomPaintHelper { +/** + * Provides a simple way to paint a single core, iterating through all {@link ICustomPaintHandler}'s that are + * registered for the core. + */ +public enum CustomPaintHelper +{ INSTANCE; /* If you want to test your class-based rotation registration then add the system property @@ -32,84 +34,119 @@ public enum CustomPaintHelper { private final Map> handlers = Maps.newIdentityHashMap(); private final List allHandlers = Lists.newArrayList(); - /** Registers a handler that will be called LAST for ALL blocks, if all other paint handlers have returned PASS or - * none are registered for that block. */ - public void registerHandlerForAll(ICustomPaintHandler handler) { - if (DEBUG) { + /** + * Registers a handler that will be called LAST for ALL blocks, if all other paint handlers have returned PASS or + * none are registered for that core. + */ + public void registerHandlerForAll(ICustomPaintHandler handler) + { + if (DEBUG) + { BCLog.logger.info("[api.painting] Adding a paint handler for ALL blocks (" + handler.getClass() + ")"); } allHandlers.add(handler); } - /** Register's a paint handler for every class of a given block. */ - public void registerHandlerForAll(Class blockClass, ICustomPaintHandler handler) { - for (Block block : Block.REGISTRY) { + /** + * Register's a paint handler for every class of a given core. + */ + public void registerHandlerForAll(Class blockClass, ICustomPaintHandler handler) + { +// for (Block block : Block.REGISTRY) + for (Block block : ForgeRegistries.BLOCKS.getValues()) + { Class foundClass = block.getClass(); - if (blockClass.isAssignableFrom(foundClass)) { - if (DEBUG) { - BCLog.logger.info("[api.painting] Found an assignable block " + block.getRegistryName() + " (" + foundClass + ") for " + blockClass); + if (blockClass.isAssignableFrom(foundClass)) + { + if (DEBUG) + { + BCLog.logger.info("[api.painting] Found an assignable core " + block.getRegistryName() + " (" + foundClass + ") for " + blockClass); } registerHandlerInternal(block, handler); } } } - public void registerHandler(Block block, ICustomPaintHandler handler) { - if (registerHandlerInternal(block, handler)) { - if (DEBUG) { - BCLog.logger.info("[api.painting] Setting a paint handler for block " + block.getRegistryName() + "(" + handler.getClass() + ")"); + public void registerHandler(Block block, ICustomPaintHandler handler) + { + if (registerHandlerInternal(block, handler)) + { + if (DEBUG) + { + BCLog.logger.info("[api.painting] Setting a paint handler for core " + block.getRegistryName() + "(" + handler.getClass() + ")"); } - } else if (DEBUG) { - BCLog.logger.info("[api.painting] Adding another paint handler for block " + block.getRegistryName() + "(" + handler.getClass() + ")"); + } + else if (DEBUG) + { + BCLog.logger.info("[api.painting] Adding another paint handler for core " + block.getRegistryName() + "(" + handler.getClass() + ")"); } } - private boolean registerHandlerInternal(Block block, ICustomPaintHandler handler) { - if (!handlers.containsKey(block)) { + private boolean registerHandlerInternal(Block block, ICustomPaintHandler handler) + { + if (!handlers.containsKey(block)) + { List forBlock = Lists.newArrayList(); forBlock.add(handler); handlers.put(block, forBlock); return true; - } else { + } + else + { handlers.get(block).add(handler); return false; } } - /** Attempts to paint a block at the given position. Basically iterates through all registered paint handlers. */ - public EnumActionResult attemptPaintBlock(World world, BlockPos pos, IBlockState state, Vec3d hitPos, @Nullable EnumFacing hitSide, @Nullable EnumDyeColor paint) { + /** + * Attempts to paint a core at the given position. Basically iterates through all registered paint handlers. + */ + public InteractionResult attemptPaintBlock(Level world, BlockPos pos, BlockState state, Vec3 hitPos, @Nullable Direction hitSide, @Nullable DyeColor paint) + { Block block = state.getBlock(); - if (block instanceof ICustomPaintHandler) { + if (block instanceof ICustomPaintHandler) + { return ((ICustomPaintHandler) block).attemptPaint(world, pos, state, hitPos, hitSide, paint); } List custom = handlers.get(block); - if (custom == null || custom.isEmpty()) { + if (custom == null || custom.isEmpty()) + { return defaultAttemptPaint(world, pos, state, hitPos, hitSide, paint); } - for (ICustomPaintHandler handler : custom) { - EnumActionResult result = handler.attemptPaint(world, pos, state, hitPos, hitSide, paint); - if (result != EnumActionResult.PASS) { + for (ICustomPaintHandler handler : custom) + { + InteractionResult result = handler.attemptPaint(world, pos, state, hitPos, hitSide, paint); + if (result != InteractionResult.PASS) + { return result; } } return defaultAttemptPaint(world, pos, state, hitPos, hitSide, paint); } - private EnumActionResult defaultAttemptPaint(World world, BlockPos pos, IBlockState state, Vec3d hitPos, EnumFacing hitSide, @Nullable EnumDyeColor paint) { - for (ICustomPaintHandler handler : allHandlers) { - EnumActionResult result = handler.attemptPaint(world, pos, state, hitPos, hitSide, paint); - if (result != EnumActionResult.PASS) { + private InteractionResult defaultAttemptPaint(Level world, BlockPos pos, BlockState state, Vec3 hitPos, Direction hitSide, @Nullable DyeColor paint) + { + for (ICustomPaintHandler handler : allHandlers) + { + InteractionResult result = handler.attemptPaint(world, pos, state, hitPos, hitSide, paint); + if (result != InteractionResult.PASS) + { return result; } } - if (paint == null) { - return EnumActionResult.FAIL; + if (paint == null) + { + return InteractionResult.FAIL; } Block b = state.getBlock(); - if (b.recolorBlock(world, pos, hitSide, paint)) { - return EnumActionResult.SUCCESS; - } else { - return EnumActionResult.FAIL; +// if (b.recolorBlock(world, pos, hitSide, paint)) + if (BlockUtil.recolorBlock(world, pos, hitSide, paint)) + { + return InteractionResult.SUCCESS; + } + else + { + return InteractionResult.FAIL; } } } diff --git a/api/buildcraft/api/blocks/CustomRotationHelper.java b/api/buildcraft/api/blocks/CustomRotationHelper.java index 235c0de..dbc9ac0 100644 --- a/api/buildcraft/api/blocks/CustomRotationHelper.java +++ b/api/buildcraft/api/blocks/CustomRotationHelper.java @@ -1,22 +1,22 @@ package buildcraft.api.blocks; -import java.util.List; -import java.util.Map; - +import buildcraft.api.core.BCDebugging; +import buildcraft.api.core.BCLog; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Registry; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import buildcraft.api.core.BCDebugging; -import buildcraft.api.core.BCLog; +import java.util.List; +import java.util.Map; -public enum CustomRotationHelper { +public enum CustomRotationHelper +{ INSTANCE; /* If you want to test your class-based rotation registration then add the system property @@ -26,11 +26,13 @@ public enum CustomRotationHelper { private final Map> handlers = Maps.newIdentityHashMap(); public void registerHandlerForAll(Class blockClass, ICustomRotationHandler handler) { - for (Block block : Block.REGISTRY) { + // 不知道是不是应该这样遍历方块 + for (Block block : Registry.BLOCK.stream().toList()) { + Class foundClass = block.getClass(); if (blockClass.isAssignableFrom(foundClass)) { if (DEBUG) { - BCLog.logger.info("[api.rotation] Found an assignable block " + block.getRegistryName() + " (" + foundClass + ") for " + blockClass); + BCLog.logger.info("[api.rotation] Found an assignable core " + block.getRegistryName() + " (" + foundClass + ") for " + blockClass); } registerHandlerInternal(block, handler); } @@ -40,10 +42,10 @@ public void registerHandlerForAll(Class blockClass, ICustomRota public void registerHandler(Block block, ICustomRotationHandler handler) { if (registerHandlerInternal(block, handler)) { if (DEBUG) { - BCLog.logger.info("[api.rotation] Setting a rotation handler for block " + block.getRegistryName()); + BCLog.logger.info("[api.rotation] Setting a rotation handler for core " + block.getRegistryName()); } } else if (DEBUG) { - BCLog.logger.info("[api.rotation] Adding another rotation handler for block " + block.getRegistryName()); + BCLog.logger.info("[api.rotation] Adding another rotation handler for core " + block.getRegistryName()); } } @@ -59,18 +61,18 @@ private boolean registerHandlerInternal(Block block, ICustomRotationHandler hand } } - public EnumActionResult attemptRotateBlock(World world, BlockPos pos, IBlockState state, EnumFacing sideWrenched) { + public InteractionResult attemptRotateBlock(Level world, BlockPos pos, BlockState state, Direction sideWrenched) { Block block = state.getBlock(); if (block instanceof ICustomRotationHandler) { return ((ICustomRotationHandler) block).attemptRotation(world, pos, state, sideWrenched); } - if (!handlers.containsKey(block)) return EnumActionResult.PASS; + if (!handlers.containsKey(block)) return InteractionResult.PASS; for (ICustomRotationHandler handler : handlers.get(block)) { - EnumActionResult result = handler.attemptRotation(world, pos, state, sideWrenched); - if (result != EnumActionResult.PASS) { + InteractionResult result = handler.attemptRotation(world, pos, state, sideWrenched); + if (result != InteractionResult.PASS) { return result; } } - return EnumActionResult.PASS; + return InteractionResult.PASS; } } diff --git a/api/buildcraft/api/blocks/ICustomPaintHandler.java b/api/buildcraft/api/blocks/ICustomPaintHandler.java index fd79c91..064bded 100644 --- a/api/buildcraft/api/blocks/ICustomPaintHandler.java +++ b/api/buildcraft/api/blocks/ICustomPaintHandler.java @@ -1,31 +1,32 @@ package buildcraft.api.blocks; -import javax.annotation.Nullable; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import javax.annotation.Nullable; -/** Provides a way to paint blocks from any position. You can either implement this on a block, or register an instance - * for a block with {@link CustomPaintHelper} */ -public interface ICustomPaintHandler { - /** Attempts to paint the given block. This can also only paint a specific part of the block (as the hit position is +/** Provides a way to paint blocks from any position. You can either implement this on a core, or register an instance + * for a core with {@link CustomPaintHelper} */ +public interface ICustomPaintHandler +{ + /** Attempts to paint the given core. This can also only paint a specific part of the core (as the hit position is * given). * - * @param world The world that the block is contained within. - * @param pos The position of the block. - * @param state The current state of the block. + * @param world The world that the core is contained within. + * @param pos The position of the core. + * @param state The current state of the core. * @param hitPos The absolute hit position of the paintbrush, relative the world's origin. - * @param hitSide The side of the block that was hit. + * @param hitSide The side of the core that was hit. * @param paintColour The paint colour to attempt to paint with, null if the paint should be cleared (so if this was - * a stained glass block, and null was passed, this would set it to a normal, clear, non-stained glass - * block. - * @return The result of attempting to paint. SUCCESS means that you changed the block from before to a new value, - * FAIL means you COULD have handled the block, but it was already painted to that colour, or PASS if you - * have no idea how to handle the block in question. */ - EnumActionResult attemptPaint(World world, BlockPos pos, IBlockState state, Vec3d hitPos, @Nullable EnumFacing hitSide, @Nullable EnumDyeColor paintColour); + * a stained glass core, and null was passed, this would set it to a normal, clear, non-stained glass + * core. + * @return The result of attempting to paint. SUCCESS means that you changed the core from before to a new value, + * FAIL means you COULD have handled the core, but it was already painted to that colour, or PASS if you + * have no idea how to handle the core in question. */ + InteractionResult attemptPaint(Level world, BlockPos pos, BlockState state, Vec3 hitPos, @Nullable Direction hitSide, @Nullable DyeColor paintColour); } diff --git a/api/buildcraft/api/blocks/ICustomRotationHandler.java b/api/buildcraft/api/blocks/ICustomRotationHandler.java index 9076f8f..3471a6a 100644 --- a/api/buildcraft/api/blocks/ICustomRotationHandler.java +++ b/api/buildcraft/api/blocks/ICustomRotationHandler.java @@ -1,11 +1,12 @@ package buildcraft.api.blocks; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; -public interface ICustomRotationHandler { - EnumActionResult attemptRotation(World world, BlockPos pos, IBlockState state, EnumFacing sideWrenched); +public interface ICustomRotationHandler +{ + InteractionResult attemptRotation(Level world, BlockPos pos, BlockState state, Direction sideWrenched); } diff --git a/api/buildcraft/api/blocks/package-info.java b/api/buildcraft/api/blocks/package-info.java index 47ae1d2..6096d75 100644 --- a/api/buildcraft/api/blocks/package-info.java +++ b/api/buildcraft/api/blocks/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_blocks") +//@API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_blocks") package buildcraft.api.blocks; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/boards/RedstoneBoardNBT.java b/api/buildcraft/api/boards/RedstoneBoardNBT.java index 0ced64a..1508afa 100755 --- a/api/buildcraft/api/boards/RedstoneBoardNBT.java +++ b/api/buildcraft/api/boards/RedstoneBoardNBT.java @@ -4,38 +4,37 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.boards; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; + import java.util.List; import java.util.Random; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import net.minecraftforge.common.util.Constants; - public abstract class RedstoneBoardNBT { private static Random rand = new Random(); public abstract String getID(); - public abstract void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced); + public abstract void addInformation(ItemStack stack, Player player, List list, boolean advanced); public abstract String getDisplayName(); - public abstract IRedstoneBoard create(NBTTagCompound nbt, T object); + public abstract IRedstoneBoard create(CompoundTag nbt, T object); public abstract String getItemModelLocation(); - public void createBoard(NBTTagCompound nbt) { - nbt.setString("id", getID()); + public void createBoard(CompoundTag nbt) { + nbt.putString("id", getID()); } - public int getParameterNumber(NBTTagCompound nbt) { - if (!nbt.hasKey("parameters")) { + public int getParameterNumber(CompoundTag nbt) { + if (!nbt.contains("parameters")) { return 0; } else { - return nbt.getTagList("parameters", Constants.NBT.TAG_COMPOUND).tagCount(); + return nbt.getList("parameters", Tag.TAG_COMPOUND).size(); } } diff --git a/api/buildcraft/api/boards/RedstoneBoardRegistry.java b/api/buildcraft/api/boards/RedstoneBoardRegistry.java index edfe79c..ba830f3 100755 --- a/api/buildcraft/api/boards/RedstoneBoardRegistry.java +++ b/api/buildcraft/api/boards/RedstoneBoardRegistry.java @@ -4,9 +4,10 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.boards; -import java.util.Collection; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundTag; + +import java.util.Collection; public abstract class RedstoneBoardRegistry { @@ -22,7 +23,7 @@ public abstract class RedstoneBoardRegistry { public abstract RedstoneBoardRobotNBT getEmptyRobotBoard(); - public abstract RedstoneBoardNBT getRedstoneBoard(NBTTagCompound nbt); + public abstract RedstoneBoardNBT getRedstoneBoard(CompoundTag nbt); public abstract RedstoneBoardNBT getRedstoneBoard(String id); diff --git a/api/buildcraft/api/boards/RedstoneBoardRobotNBT.java b/api/buildcraft/api/boards/RedstoneBoardRobotNBT.java index 4a4161b..cb7debb 100755 --- a/api/buildcraft/api/boards/RedstoneBoardRobotNBT.java +++ b/api/buildcraft/api/boards/RedstoneBoardRobotNBT.java @@ -4,15 +4,14 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.boards; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ResourceLocation; - import buildcraft.api.robots.EntityRobotBase; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; public abstract class RedstoneBoardRobotNBT extends RedstoneBoardNBT { @Override - public RedstoneBoardRobot create(NBTTagCompound nbt, EntityRobotBase robot) { + public RedstoneBoardRobot create(CompoundTag nbt, EntityRobotBase robot) { return create(robot); } diff --git a/api/buildcraft/api/boards/package-info.java b/api/buildcraft/api/boards/package-info.java index 69405e4..8aa09ed 100644 --- a/api/buildcraft/api/boards/package-info.java +++ b/api/buildcraft/api/boards/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_boards") +//@API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_boards") package buildcraft.api.boards; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/core/AreaProviders.java b/api/buildcraft/api/core/AreaProviders.java deleted file mode 100644 index 0ebe02f..0000000 --- a/api/buildcraft/api/core/AreaProviders.java +++ /dev/null @@ -1,24 +0,0 @@ -package buildcraft.api.core; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public class AreaProviders { - public static final List providers = new ArrayList<>(); - - public interface IAreaProviderGetter { - /** @return All of the {@link IAreaProvider}'s that contain the specified block psoition. */ - List getAreaProviders(World world, BlockPos at); - } - - public static List getAreaProviders(World world, BlockPos at) { - List list = new ArrayList<>(); - for (IAreaProviderGetter getter : providers) { - list.addAll(getter.getAreaProviders(world, at)); - } - return list; - } -} diff --git a/api/buildcraft/api/core/BCDebugging.java b/api/buildcraft/api/core/BCDebugging.java index 14e5917..88dbed0 100644 --- a/api/buildcraft/api/core/BCDebugging.java +++ b/api/buildcraft/api/core/BCDebugging.java @@ -4,21 +4,16 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; + import java.lang.reflect.Method; import java.util.Locale; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.LoaderState; -import net.minecraftforge.fml.common.ModContainer; - -import buildcraft.api.BCModules; - /** Provides a way to quickly enable or disable certain debug conditions via VM arguments or whether the client/server * is in a dev environment */ -public class BCDebugging { +public class BCDebugging +{ public enum DebugStatus { NONE, ENABLE, @@ -48,8 +43,8 @@ enum DebugLevel { boolean isDev; try { - Method getTileEntity = World.class.getDeclaredMethod("getTileEntity", BlockPos.class); - BCLog.logger.info("[debugger] Method found: World.getTileEntity = " + getTileEntity); + Method getBlockEntity = Level.class.getDeclaredMethod("getBlockEntity", BlockPos.class); + BCLog.logger.info("[debugger] Method found: Level.getBlockEntity = " + getBlockEntity); isDev = true; } catch (Throwable ignored) { // If it didn't find it then we aren't in a dev environment diff --git a/api/buildcraft/api/core/BCLog.java b/api/buildcraft/api/core/BCLog.java index f745091..65d176a 100644 --- a/api/buildcraft/api/core/BCLog.java +++ b/api/buildcraft/api/core/BCLog.java @@ -8,7 +8,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public final class BCLog { +public final class BCLog +{ public static final Logger logger = LogManager.getLogger("BuildCraft"); /** Deactivate constructor */ diff --git a/api/buildcraft/api/core/BuildCraftAPI.java b/api/buildcraft/api/core/BuildCraftAPI.java index f7f24c0..1bb2e1d 100644 --- a/api/buildcraft/api/core/BuildCraftAPI.java +++ b/api/buildcraft/api/core/BuildCraftAPI.java @@ -1,59 +1,73 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** + * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ + * should be located as "LICENSE.API" in the BuildCraft source code distribution. + */ package buildcraft.api.core; -import java.util.HashMap; -import java.util.Set; - import com.google.common.collect.Maps; import com.google.common.collect.Sets; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraftforge.fml.ModContainer; +import net.minecraftforge.fml.ModList; +import net.minecraftforge.fml.ModLoadingContext; -import net.minecraft.block.Block; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; +import java.util.HashMap; +import java.util.Set; -public final class BuildCraftAPI { +public final class BuildCraftAPI +{ public static IFakePlayerProvider fakePlayerProvider; public static final Set softBlocks = Sets.newHashSet(); public static final HashMap worldProperties = Maps.newHashMap(); /** Deactivate constructor */ - private BuildCraftAPI() {} + private BuildCraftAPI() + { + } - public static String getVersion() { - ModContainer container = Loader.instance().getIndexedModList().get("buildcraftlib"); - if (container != null) { - return container.getDisplayVersion(); + public static String getVersion() + { + ModContainer container = ModList.get().getModContainerById("buildcraftlib").get(); + if (container != null) + { + return container.getModInfo().getVersion().getQualifier(); } return "UNKNOWN VERSION"; } - public static IWorldProperty getWorldProperty(String name) { + public static IWorldProperty getWorldProperty(String name) + { return worldProperties.get(name); } - public static void registerWorldProperty(String name, IWorldProperty property) { - if (worldProperties.containsKey(name)) { + public static void registerWorldProperty(String name, IWorldProperty property) + { + if (worldProperties.containsKey(name)) + { BCLog.logger.warn("The WorldProperty key '" + name + "' is being overridden with " + property.getClass().getSimpleName() + "!"); } worldProperties.put(name, property); } - public static boolean isSoftBlock(World world, BlockPos pos) { + public static boolean isSoftBlock(Level world, BlockPos pos) + { return worldProperties.get("soft").get(world, pos); } - public static ResourceLocation nameToResourceLocation(String name) { + public static ResourceLocation nameToResourceLocation(String name) + { if (name.indexOf(':') > 0) return new ResourceLocation(name); - ModContainer modContainer = Loader.instance().activeModContainer(); - if (modContainer == null) { +// ModContainer modContainer = ModLoader.get().activeModContainer(); + ModContainer modContainer = ModLoadingContext.get().getActiveContainer(); +// ModContainer modContainer = ModList.get().getModContainerById(BuildCraft.MOD_ID); + if (modContainer == null) + { throw new IllegalStateException("Illegal recipe name " + name + ". Provide domain id to register it correctly."); } return new ResourceLocation(modContainer.getModId(), name); diff --git a/api/buildcraft/api/core/CapabilitiesHelper.java b/api/buildcraft/api/core/CapabilitiesHelper.java index e39a8c4..5786dbd 100644 --- a/api/buildcraft/api/core/CapabilitiesHelper.java +++ b/api/buildcraft/api/core/CapabilitiesHelper.java @@ -1,20 +1,12 @@ package buildcraft.api.core; -import java.lang.reflect.Field; -import java.util.IdentityHashMap; -import java.util.concurrent.Callable; - -import javax.annotation.Nonnull; - -import net.minecraft.nbt.NBTBase; -import net.minecraft.util.EnumFacing; - import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.Capability.IStorage; -import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; -/** Forge has a wonderful system for capabilities, which provides a better way of managing mod compat even if the target +import java.util.concurrent.Callable; + +/** + * Forge has a wonderful system for capabilities, which provides a better way of managing mod compat even if the target * mod isn't loaded. Said system uses ASM data to inject capabilities into every mod, which makes it a matter of * checking a (generic) field at runtime. *

@@ -26,8 +18,10 @@ *

* This is NOT designed for mods wishing to add compatibility for buildcraft capability instances: those should still go * via the forge-recommended {@link CapabilityInject} route, or refer to the various fields in buildcraft api classes - * containing the capability instances. */ -public class CapabilitiesHelper { + * containing the capability instances. + */ +public class CapabilitiesHelper +{ // ################ // @@ -35,62 +29,92 @@ public class CapabilitiesHelper { // // ################ - /** Registers a given type with {@link #registerCapability(CheckedStorage, Callable)}, but with a + /** + * Registers a given type with {@link #registerCapability(CheckedStorage, Callable)}, but with a * {@link ThrowingStorage} and a factory that throws an {@link UnsupportedOperationException} instead of creating a * new capability instance. - * + * * @param clazz The type that all instances must derive from. - * @return The registered {@link Capability} */ - @Nonnull - public static Capability registerCapability(Class clazz) { - return registerCapability(new ThrowingStorage<>(clazz), () -> { - throw new UnsupportedOperationException("You must create your own instances!"); - }); - } - - /** Registers a given type with the {@link CapabilityManager}, but also returns the capability instance. - * + * @return The registered {@link Capability} + */ +// @Nonnull +// public static Capability registerCapability(Class clazz) +// { +//// return registerCapability(new ThrowingStorage<>(clazz), () -> +//// { +//// throw new UnsupportedOperationException("You must create your own instances!"); +//// }); +// return CapabilityManager.get(new CapabilityToken<>(){}); +// } + + /** + * Registers a given type with the {@link CapabilityManager}, but also returns the capability instance. + * * @param storage The storage for the capability. This must extend {@link CheckedStorage} in order to allow the - * internal mechanisms to ensure that nothing went wrong during our meddling into forge. + * internal mechanisms to ensure that nothing went wrong during our meddling into forge. * @param factory The factory for the capability. - * @return The registered {@link Capability} */ - @Nonnull - public static Capability registerCapability(CheckedStorage storage, Callable factory) { - return registerCapInternal(storage, factory); - } - - /** A type of {@link IStorage} that contains the class that it would store. Used by the internal mechanisms of + * @return The registered {@link Capability} + */ +// @Nonnull +// public static Capability registerCapability(CheckedStorage storage, Callable factory) +// { +// return registerCapInternal(storage, factory); +// } + + /** + * A type of {@link IStorage} that contains the class that it would store. Used by the internal mechanisms of * {@link CapabilitiesHelper} to ensure that everything registers properly. A default always-throwing implementation * is {@link ThrowingStorage}. - * - * @param The type of this storage */ - public static abstract class CheckedStorage implements IStorage { - - public final Class clazz; - - public CheckedStorage(Class clazz) { - this.clazz = clazz; - } - } - - /** A type of {@link CheckedStorage} that throws an {@link UnsupportedOperationException} from both the read and - * write methods. It is designed for {@link Capability Capability's} that must be written and read separately. */ - public static final class ThrowingStorage extends CheckedStorage { - - public ThrowingStorage(Class clazz) { - super(clazz); - } - - @Override - public NBTBase writeNBT(Capability capability, T instance, EnumFacing side) { - throw new UnsupportedOperationException("You must create your own instances!"); - } - - @Override - public void readNBT(Capability capability, T instance, EnumFacing side, NBTBase nbt) { - throw new UnsupportedOperationException("You must create your own instances!"); - } - } + * + * @param The type of this storage + */ +//// public static abstract class CheckedStorage implements IStorage +// public static abstract class CheckedStorage implements ICapabilityProvider, INBTSerializable +// { +// +// public final Class clazz; +// +// public CheckedStorage(Class clazz) +// { +// this.clazz = clazz; +// } +// } + + /** + * A type of {@link CheckedStorage} that throws an {@link UnsupportedOperationException} from both the read and + * write methods. It is designed for {@link Capability Capability's} that must be written and read separately. + */ +// public static final class ThrowingStorage extends CheckedStorage +// { +// private T capInnerInstance; +// +// public ThrowingStorage(Class clazz) +// { +// super(clazz); +// capInnerInstance = new T(); +// } +// +// @Override +//// public Tag writeNBT(Capability capability, T instance, Direction side) +// public Tag serializeNBT() +// { +// throw new UnsupportedOperationException("You must create your own instances!"); +// } +// +// @Override +//// public void readNBT(Capability capability, T instance, Direction side, Tag nbt) +// public void deserializeNBT(Tag nbt) +// { +// throw new UnsupportedOperationException("You must create your own instances!"); +// } +// +// @NotNull +// @Override +// public LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) +// { +// return null; +// } +// } // ################ // @@ -98,74 +122,91 @@ public void readNBT(Capability capability, T instance, EnumFacing side, NBTBa // // ################ - private static final IdentityHashMap __FIELD_CAP_MANAGER_PROVIDERS; - - static { - try { - Field fld = CapabilityManager.class.getDeclaredField("providers"); - fld.setAccessible(true); - Object obj = fld.get(CapabilityManager.INSTANCE); - __FIELD_CAP_MANAGER_PROVIDERS = (IdentityHashMap) obj; - if (__FIELD_CAP_MANAGER_PROVIDERS == null) { - throw new Error("Couldn't find providers!"); - } - } catch (ReflectiveOperationException | ClassCastException e) { - throw new Error(e); - } - } - - @Nonnull - private static Capability registerCapInternal(CheckedStorage storage, Callable factory) { - Class clazz = storage.clazz; - - CapabilityManager.INSTANCE.register(clazz, storage, factory); - - String fullName = clazz.getName().intern(); - Object obj = __FIELD_CAP_MANAGER_PROVIDERS.get(fullName); - if (obj == null) { - throw new IllegalStateException("Apparently we didn't register the capability? How?"); - } - if (!(obj instanceof Capability)) { - throw new Error("We must have the wrong map! providers.get(key) returned " + obj.getClass() - + " rather than " + Capability.class); - } - Capability cap = (Capability) obj; - // Ensure that the given cap is actually *our* capability - // compare the given class with the VoidStorage class, as - // Capability doesn't have a way of doing that directly. - IStorage cStorage = cap.getStorage(); - if (!(cStorage instanceof CheckedStorage)) { - throw new IllegalStateException( - "Returned capability storage has a different storage class than expected! " + cStorage.getClass()); - } - CheckedStorage vStorage = (CheckedStorage) cStorage; - if (vStorage.clazz != clazz) { - throw new IllegalStateException( - "Returned capability storage has a different class than expected! " + vStorage.clazz + " vs " + clazz); - } - return (Capability) cap; - } - - /** Prefer {@link #registerCapability(Class)} or other methods over this one: this will be removed at some point in - * the future. Most likely before beta. */ - @Nonnull - @Deprecated - public static Capability ensureRegistration(Capability cap, Class clazz) { - if (cap == null) { - throw new Error("Capability registration failed for " + clazz); - } - return cap; - } - - public static class VoidStorage implements Capability.IStorage { - @Override - public NBTBase writeNBT(Capability capability, T instance, EnumFacing side) { - throw new IllegalStateException("You must create your own instances!"); - } - - @Override - public void readNBT(Capability capability, T instance, EnumFacing side, NBTBase nbt) { - throw new IllegalStateException("You must create your own instances!"); - } - } +// private static final IdentityHashMap __FIELD_CAP_MANAGER_PROVIDERS; +// +// static +// { +// try +// { +// Field fld = CapabilityManager.class.getDeclaredField("providers"); +// fld.setAccessible(true); +// Object obj = fld.get(CapabilityManager.INSTANCE); +// __FIELD_CAP_MANAGER_PROVIDERS = (IdentityHashMap) obj; +// if (__FIELD_CAP_MANAGER_PROVIDERS == null) +// { +// throw new Error("Couldn't find providers!"); +// } +// } +// catch (ReflectiveOperationException | ClassCastException e) +// { +// throw new Error(e); +// } +// } + +// @Nonnull +// private static Capability registerCapInternal(CheckedStorage storage, Callable factory) +// { +// Class clazz = storage.clazz; +// +// CapabilityManager.INSTANCE.register(clazz, storage, factory); +// +// String fullName = clazz.getName().intern(); +// Object obj = __FIELD_CAP_MANAGER_PROVIDERS.get(fullName); +// if (obj == null) +// { +// throw new IllegalStateException("Apparently we didn't register the capability? How?"); +// } +// if (!(obj instanceof Capability)) +// { +// throw new Error("We must have the wrong map! providers.get(key) returned " + obj.getClass() +// + " rather than " + Capability.class); +// } +// Capability cap = (Capability) obj; +// // Ensure that the given cap is actually *our* capability +// // compare the given class with the VoidStorage class, as +// // Capability doesn't have a way of doing that directly. +// IStorage cStorage = cap.getStorage(); +// if (!(cStorage instanceof CheckedStorage)) +// { +// throw new IllegalStateException( +// "Returned capability storage has a different storage class than expected! " + cStorage.getClass()); +// } +// CheckedStorage vStorage = (CheckedStorage) cStorage; +// if (vStorage.clazz != clazz) +// { +// throw new IllegalStateException( +// "Returned capability storage has a different class than expected! " + vStorage.clazz + " vs " + clazz); +// } +// return (Capability) cap; +// } + +// /** +// * Prefer {@link #registerCapability(Class)} or other methods over this one: this will be removed at some point in +// * the future. Most likely before beta. +// */ +// @Nonnull +// @Deprecated +// public static Capability ensureRegistration(Capability cap, Class clazz) +// { +// if (cap == null) +// { +// throw new Error("Capability registration failed for " + clazz); +// } +// return cap; +// } + +// public static class VoidStorage implements Capability.IStorage +// { +// @Override +// public Tag writeNBT(Capability capability, T instance, Direction side) +// { +// throw new IllegalStateException("You must create your own instances!"); +// } +// +// @Override +// public void readNBT(Capability capability, T instance, Direction side, Tag nbt) +// { +// throw new IllegalStateException("You must create your own instances!"); +// } +// } } diff --git a/api/buildcraft/api/core/EnumColor.java b/api/buildcraft/api/core/EnumColor.java deleted file mode 100644 index 0288438..0000000 --- a/api/buildcraft/api/core/EnumColor.java +++ /dev/null @@ -1,147 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import java.util.Locale; -import java.util.Random; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.IStringSerializable; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.translation.I18n; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** Use minecraft's EnumDyeColor in as many places as possible. */ -@Deprecated -public enum EnumColor implements IStringSerializable { - - BLACK, - RED, - GREEN, - BROWN, - BLUE, - PURPLE, - CYAN, - LIGHT_GRAY, - GRAY, - PINK, - LIME, - YELLOW, - LIGHT_BLUE, - MAGENTA, - ORANGE, - WHITE; - - public static final EnumColor[] VALUES = values(); - public static final String[] DYES = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", - "dyePink", "dyeLime", "dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite" }; - public static final String[] NAMES = { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", - "LightBlue", "Magenta", "Orange", "White" }; - public static final int[] DARK_HEX = { 0x2D2D2D, 0xA33835, 0x394C1E, 0x5C3A24, 0x3441A2, 0x843FBF, 0x36809E, 0x888888, 0x444444, 0xE585A0, - 0x3FAA36, 0xCFC231, 0x7F9AD1, 0xFF64FF, 0xFF6A00, 0xFFFFFF }; - public static final int[] LIGHT_HEX = { 0x181414, 0xBE2B27, 0x007F0E, 0x89502D, 0x253193, 0x7e34bf, 0x299799, 0xa0a7a7, 0x7A7A7A, 0xD97199, - 0x39D52E, 0xFFD91C, 0x66AAFF, 0xD943C6, 0xEA7835, 0xe4e4e4 }; - - @SideOnly(Side.CLIENT) - private static ResourceLocation iconSheet; - - @SideOnly(Side.CLIENT) - private static TextureAtlasSprite[] brushSprites; - - public int getDarkHex() { - return DARK_HEX[ordinal()]; - } - - public int getLightHex() { - return LIGHT_HEX[ordinal()]; - } - - public static EnumColor fromId(int id) { - if (id < 0 || id >= VALUES.length) { - return WHITE; - } - return VALUES[id]; - } - - public static EnumColor fromDye(String dyeTag) { - for (int id = 0; id < DYES.length; id++) { - if (DYES[id].equals(dyeTag)) { - return VALUES[id]; - } - } - return null; - } - - public static EnumColor fromName(String name) { - for (int id = 0; id < NAMES.length; id++) { - if (NAMES[id].equals(name)) { - return VALUES[id]; - } - } - return null; - } - - public static EnumColor getRand() { - return VALUES[new Random().nextInt(VALUES.length)]; - } - - public EnumColor getNext() { - EnumColor next = VALUES[(ordinal() + 1) % VALUES.length]; - return next; - } - - public EnumColor getPrevious() { - EnumColor previous = VALUES[(ordinal() + VALUES.length - 1) % VALUES.length]; - return previous; - } - - public EnumColor inverse() { - return EnumColor.VALUES[15 - ordinal()]; - } - - public String getTag() { - return "color." + name().replace("_", ".").toLowerCase(Locale.ENGLISH); - } - - public String getBasicTag() { - return name().replace("_", ".").toLowerCase(Locale.ENGLISH); - } - - @Override - public String getName() { - return NAMES[ordinal()]; - } - - public String getLocalizedName() { - return I18n.translateToLocal(getTag()); - } - - public String getDye() { - return DYES[ordinal()]; - } - - @Override - public String toString() { - String s = name().replace("_", " "); - String[] words = s.split(" "); - StringBuilder b = new StringBuilder(); - for (String word : words) { - b.append(word.charAt(0)).append(word.substring(1).toLowerCase(Locale.ENGLISH)).append(" "); - } - return b.toString().trim(); - } - - @SideOnly(Side.CLIENT) - public static void registerSprites(TextureAtlasSprite[] sprites) { - brushSprites = sprites; - } - - @SideOnly(Side.CLIENT) - public TextureAtlasSprite getSprite() { - return brushSprites[ordinal()]; - } -} diff --git a/api/buildcraft/api/core/EnumPipePart.java b/api/buildcraft/api/core/EnumPipePart.java index 3eb3731..01ba7bf 100644 --- a/api/buildcraft/api/core/EnumPipePart.java +++ b/api/buildcraft/api/core/EnumPipePart.java @@ -1,23 +1,23 @@ package buildcraft.api.core; +import com.google.common.collect.Maps; +import net.minecraft.core.Direction; +import net.minecraft.nbt.NumericTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.nbt.Tag; +import net.minecraft.util.StringRepresentable; + import java.util.Locale; import java.util.Map; -import com.google.common.collect.Maps; - -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTPrimitive; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.IStringSerializable; - -public enum EnumPipePart implements IStringSerializable { - DOWN(EnumFacing.DOWN), - UP(EnumFacing.UP), - NORTH(EnumFacing.NORTH), - SOUTH(EnumFacing.SOUTH), - WEST(EnumFacing.WEST), - EAST(EnumFacing.EAST), +public enum EnumPipePart implements StringRepresentable +{ + DOWN(Direction.DOWN), + UP(Direction.UP), + NORTH(Direction.NORTH), + SOUTH(Direction.SOUTH), + WEST(Direction.WEST), + EAST(Direction.EAST), /** CENTER, UNKNOWN and ALL are all valid uses of this. */ CENTER(null); @@ -25,22 +25,25 @@ public enum EnumPipePart implements IStringSerializable { public static final EnumPipePart[] FACES; public static final EnumPipePart[] HORIZONTALS; - private static final Map facingMap = Maps.newEnumMap(EnumFacing.class); + private static final Map facingMap = Maps.newEnumMap(Direction.class); private static final Map nameMap = Maps.newHashMap(); private static final int MAX_VALUES = values().length; - public final EnumFacing face; + public final Direction face; static { for (EnumPipePart part : values()) { nameMap.put(part.name(), part); if (part.face != null) facingMap.put(part.face, part); } - FACES = fromFacingArray(EnumFacing.VALUES); - HORIZONTALS = fromFacingArray(EnumFacing.HORIZONTALS); + FACES = fromFacingArray(Direction.values()); + // 1.18.2 HORIZONTALS -> private BY_2D_DATA +// HORIZONTALS = fromFacingArray(Direction.HORIZONTALS); + HORIZONTALS = fromFacingArray(Direction.from2DDataValue(0),Direction.from2DDataValue(1),Direction.from2DDataValue(2),Direction.from2DDataValue(3)); + } - private static EnumPipePart[] fromFacingArray(EnumFacing... faces) { + private static EnumPipePart[] fromFacingArray(Direction... faces) { EnumPipePart[] arr = new EnumPipePart[faces.length]; for (int i = 0; i < faces.length; i++) { arr[i] = fromFacing(faces[i]); @@ -48,11 +51,11 @@ private static EnumPipePart[] fromFacingArray(EnumFacing... faces) { return arr; } - public static int ordinal(EnumFacing face) { + public static int ordinal(Direction face) { return face == null ? 6 : face.ordinal(); } - public static EnumPipePart fromFacing(EnumFacing face) { + public static EnumPipePart fromFacing(Direction face) { if (face == null) { return EnumPipePart.CENTER; } @@ -70,17 +73,17 @@ public static EnumPipePart fromMeta(int meta) { return VALUES[meta]; } - EnumPipePart(EnumFacing face) { + EnumPipePart(Direction face) { this.face = face; } public int getIndex() { if (face == null) return 6; - return face.getIndex(); + return face.get3DDataValue(); } @Override - public String getName() { + public String getSerializedName() { return name().toLowerCase(Locale.ROOT); } @@ -110,16 +113,16 @@ public EnumPipePart opposite() { return fromFacing(face.getOpposite()); } - public static EnumPipePart readFromNBT(NBTBase base) { + public static EnumPipePart readFromNBT(Tag base) { if (base == null) { return CENTER; } - if (base instanceof NBTTagString) { - NBTTagString nbtString = (NBTTagString) base; - String string = nbtString.getString(); + if (base instanceof StringTag) { + StringTag nbtString = (StringTag) base; + String string = nbtString.getAsString(); return nameMap.getOrDefault(string, CENTER); } else { - byte ord = ((NBTPrimitive) base).getByte(); + byte ord = ((NumericTag) base).getAsByte(); if (ord < 0 || ord > 6) { return CENTER; } @@ -127,7 +130,7 @@ public static EnumPipePart readFromNBT(NBTBase base) { } } - public NBTBase writeToNBT() { - return new NBTTagString(name()); + public Tag writeToNBT() { + return StringTag.valueOf(name()); } } diff --git a/api/buildcraft/api/core/EnumWireColour.java b/api/buildcraft/api/core/EnumWireColour.java deleted file mode 100644 index b6e1e3d..0000000 --- a/api/buildcraft/api/core/EnumWireColour.java +++ /dev/null @@ -1,69 +0,0 @@ -package buildcraft.api.core; - -import java.util.EnumMap; -import java.util.EnumSet; -import java.util.Set; - -import net.minecraft.item.EnumDyeColor; - -/** A subset of colours from {@link EnumDyeColor} that are suitable for use in LED's or wires (or equivalent). In other - * words they must all be uniquely identifiable from both their lit and dark colours, and not look similar to other - * colours. */ -public enum EnumWireColour { - // We disallow all variants of grey and black, as they don't make much sense relative to LED's. - // In theory we could keep black OR dark gey LED's (as they are very distant) but it's simpler not to. - WHITE(EnumDyeColor.WHITE, EnumDyeColor.SILVER, EnumDyeColor.GRAY, EnumDyeColor.BLACK), - ORANGE(EnumDyeColor.ORANGE), - // MAGENTA -> PINK - LIGHT_BLUE(EnumDyeColor.LIGHT_BLUE, EnumDyeColor.CYAN), - YELLOW(EnumDyeColor.YELLOW), - LIME(EnumDyeColor.LIME), - PINK(EnumDyeColor.PINK, EnumDyeColor.MAGENTA), - // GRAY -> WHITE - // SILVER (LIGHT_GRAY) -> WHITE - // CYAN -> LIGHT_BLUE - PURPLE(EnumDyeColor.PURPLE), - BLUE(EnumDyeColor.BLUE), - BROWN(EnumDyeColor.BROWN), - GREEN(EnumDyeColor.GREEN), - RED(EnumDyeColor.RED), - // BLACK -> WHITE - ; - - private static final EnumMap DYE_TO_WIRE; - - static { - DYE_TO_WIRE = new EnumMap<>(EnumDyeColor.class); - for (EnumWireColour wire : values()) { - for (EnumDyeColor dye : wire.similarBasedColours) { - EnumWireColour prev = DYE_TO_WIRE.put(dye, wire); - if (prev != null) { - throw new Error(wire + " attempted to override " + prev + " for the dye " + dye + "!"); - } - } - } - - for (EnumDyeColor dye : EnumDyeColor.values()) { - EnumWireColour wire = DYE_TO_WIRE.get(dye); - if (wire == null) { - throw new Error(dye + " isn't mapped to a wire colour!"); - } - } - } - - /** The primary minecraft colour that this is based on. */ - public final EnumDyeColor primaryIdenticalColour; - - /** A set of similar minecraft colours that this single colour is based on. Always includes - * {@link #primaryIdenticalColour}. */ - public final Set similarBasedColours; - - private EnumWireColour(EnumDyeColor primary, EnumDyeColor... secondary) { - this.primaryIdenticalColour = primary; - this.similarBasedColours = EnumSet.of(primary, secondary); - } - - public static EnumWireColour convertToWire(EnumDyeColor dye) { - return DYE_TO_WIRE.get(dye); - } -} diff --git a/api/buildcraft/api/core/IAreaProvider.java b/api/buildcraft/api/core/IAreaProvider.java index 02bcf0c..a42fb60 100644 --- a/api/buildcraft/api/core/IAreaProvider.java +++ b/api/buildcraft/api/core/IAreaProvider.java @@ -4,10 +4,12 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; -import net.minecraft.util.math.BlockPos; + +import net.minecraft.core.BlockPos; /** To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers. */ -public interface IAreaProvider { +public interface IAreaProvider +{ BlockPos min(); BlockPos max(); diff --git a/api/buildcraft/api/core/IBox.java b/api/buildcraft/api/core/IBox.java index 6449077..39f1c36 100644 --- a/api/buildcraft/api/core/IBox.java +++ b/api/buildcraft/api/core/IBox.java @@ -4,7 +4,7 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; /** A cuboid volume. BuildCraft's default implementation is mutable, so you should not cache instances that you do not * own as-is, without making an immutable copy first. */ @@ -18,6 +18,6 @@ public interface IBox extends IZone { BlockPos max(); default BlockPos size() { - return max().subtract(min()).add(1, 1, 1); + return max().subtract(min()).offset(1, 1, 1); } } diff --git a/api/buildcraft/api/core/IConvertable.java b/api/buildcraft/api/core/IConvertable.java index 3a5ae23..dfb9458 100644 --- a/api/buildcraft/api/core/IConvertable.java +++ b/api/buildcraft/api/core/IConvertable.java @@ -4,7 +4,8 @@ /** An object that can be converted into another type. Implementing this interface makes no guarantees that * {@link #convertTo(Class)} will actually return anything other than this or null. */ -public interface IConvertable { +public interface IConvertable +{ /** Attempts to convert this object to the given class. Returns this object if it is already an instance of the * given class, a separate object if it can be converted, or null if no conversion is possible. */ diff --git a/api/buildcraft/api/core/IEngineType.java b/api/buildcraft/api/core/IEngineType.java index b871096..ca82213 100644 --- a/api/buildcraft/api/core/IEngineType.java +++ b/api/buildcraft/api/core/IEngineType.java @@ -1,5 +1,6 @@ package buildcraft.api.core; -public interface IEngineType { +public interface IEngineType +{ String getItemModelLocation(); } diff --git a/api/buildcraft/api/core/IFakePlayerProvider.java b/api/buildcraft/api/core/IFakePlayerProvider.java index c8bed73..4a56065 100755 --- a/api/buildcraft/api/core/IFakePlayerProvider.java +++ b/api/buildcraft/api/core/IFakePlayerProvider.java @@ -7,19 +7,18 @@ package buildcraft.api.core; import com.mojang.authlib.GameProfile; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldServer; - +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraftforge.common.util.FakePlayer; -public interface IFakePlayerProvider { +public interface IFakePlayerProvider +{ /** * Returns the generic buildcraft fake player. Note that you shouldn't use this anymore, as you should store the - * UUID of the real player who created the block or entity that calls this. + * UUID of the real player who created the core or entity that calls this. */ @Deprecated - FakePlayer getBuildCraftPlayer(WorldServer world); + FakePlayer getBuildCraftPlayer(ServerLevel world); /** * @param world @@ -27,7 +26,7 @@ public interface IFakePlayerProvider { * @return A fake player that can be used IN THE CURRENT METHOD CONTEXT ONLY! This will cause problems if this * player is left around as it holds a reference to the world object. */ - FakePlayer getFakePlayer(WorldServer world, GameProfile profile); + FakePlayer getFakePlayer(ServerLevel world, GameProfile profile); /** * @param world @@ -36,5 +35,5 @@ public interface IFakePlayerProvider { * @return A fake player that can be used IN THE CURRENT METHOD CONTEXT ONLY! This will cause problems if this * player is left around as it holds a reference to the world object. */ - FakePlayer getFakePlayer(WorldServer world, GameProfile profile, BlockPos pos); + FakePlayer getFakePlayer(ServerLevel world, GameProfile profile, BlockPos pos); } diff --git a/api/buildcraft/api/core/IFluidFilter.java b/api/buildcraft/api/core/IFluidFilter.java index 0cd10d6..5920db8 100755 --- a/api/buildcraft/api/core/IFluidFilter.java +++ b/api/buildcraft/api/core/IFluidFilter.java @@ -6,7 +6,8 @@ import net.minecraftforge.fluids.FluidStack; -public interface IFluidFilter { +public interface IFluidFilter +{ boolean matches(FluidStack fluid); } diff --git a/api/buildcraft/api/core/IFluidHandlerAdv.java b/api/buildcraft/api/core/IFluidHandlerAdv.java index aba2d8a..fb8075c 100644 --- a/api/buildcraft/api/core/IFluidHandlerAdv.java +++ b/api/buildcraft/api/core/IFluidHandlerAdv.java @@ -1,18 +1,23 @@ package buildcraft.api.core; -import javax.annotation.Nullable; - import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; -/** A version of {@link IFluidHandler} that can drain a fluid that a fluid filter accepts. */ -public interface IFluidHandlerAdv extends IFluidHandler { - /** Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. +import javax.annotation.Nullable; + +/** + * A version of {@link IFluidHandler} that can drain a fluid that a fluid filter accepts. + */ +public interface IFluidHandlerAdv extends IFluidHandler +{ + /** + * Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. * - * @param filter A filter to filter the possible fluids that can be extracted. + * @param filter A filter to filter the possible fluids that can be extracted. * @param maxDrain The maximum amount of fluid to drain - * @param doDrain If false, drain will only be simulated. - * @return FluidStack representing the Fluid and amount that was (or would have been, if simulated) drained. */ + * @param doDrain If false, drain will only be simulated. + * @return FluidStack representing the Fluid and amount that was (or would have been, if simulated) drained. + */ @Nullable - FluidStack drain(IFluidFilter filter, int maxDrain, boolean doDrain); + FluidStack drain(IFluidFilter filter, int maxDrain, FluidAction doDrain); } diff --git a/api/buildcraft/api/core/IInvSlot.java b/api/buildcraft/api/core/IInvSlot.java deleted file mode 100644 index a047a2f..0000000 --- a/api/buildcraft/api/core/IInvSlot.java +++ /dev/null @@ -1,26 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.item.ItemStack; - -public interface IInvSlot { - /** Returns the slot number of the underlying Inventory. - * - * @return the slot number */ - int getIndex(); - - boolean canPutStackInSlot(ItemStack stack); - - boolean canTakeStackFromSlot(ItemStack stack); - - boolean isItemValidForSlot(ItemStack stack); - - ItemStack decreaseStackInSlot(int amount); - - ItemStack getStackInSlot(); - - void setStackInSlot(ItemStack stack); -} diff --git a/api/buildcraft/api/core/IPathProvider.java b/api/buildcraft/api/core/IPathProvider.java index f21ef36..d2397e2 100644 --- a/api/buildcraft/api/core/IPathProvider.java +++ b/api/buildcraft/api/core/IPathProvider.java @@ -1,13 +1,13 @@ package buildcraft.api.core; -import java.util.List; - -import net.minecraft.util.math.BlockPos; - import buildcraft.api.items.IMapLocation.MapLocationType; +import net.minecraft.core.BlockPos; + +import java.util.List; /** To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers. */ -public interface IPathProvider { +public interface IPathProvider +{ /** @return The completed path. This should loop back onto itself (The last position is the same as the first * position) if you are {@link MapLocationType#PATH_REPEATING} */ List getPath(); diff --git a/api/buildcraft/api/core/IPlayerOwned.java b/api/buildcraft/api/core/IPlayerOwned.java index 8aa80fe..b710c4d 100644 --- a/api/buildcraft/api/core/IPlayerOwned.java +++ b/api/buildcraft/api/core/IPlayerOwned.java @@ -3,6 +3,7 @@ import com.mojang.authlib.GameProfile; /** Defines an entity or tile that is owned by a specific player. */ -public interface IPlayerOwned { +public interface IPlayerOwned +{ GameProfile getOwner(); } diff --git a/api/buildcraft/api/core/IStackFilter.java b/api/buildcraft/api/core/IStackFilter.java index 4f450c6..b84701d 100644 --- a/api/buildcraft/api/core/IStackFilter.java +++ b/api/buildcraft/api/core/IStackFilter.java @@ -4,14 +4,15 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.core; -import javax.annotation.Nonnull; +import net.minecraft.core.NonNullList; +import net.minecraft.world.item.ItemStack; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; +import javax.annotation.Nonnull; /** This interface provides a convenient means of dealing with entire classes of items without having to specify each * item individually. */ -public interface IStackFilter { +public interface IStackFilter +{ /** Check to see if a given stack matches this filter. * diff --git a/api/buildcraft/api/core/IWorldProperty.java b/api/buildcraft/api/core/IWorldProperty.java index 415dc12..034786c 100755 --- a/api/buildcraft/api/core/IWorldProperty.java +++ b/api/buildcraft/api/core/IWorldProperty.java @@ -4,11 +4,12 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; -public interface IWorldProperty { - boolean get(World world, BlockPos pos); +public interface IWorldProperty +{ + boolean get(Level world, BlockPos pos); void clear(); } diff --git a/api/buildcraft/api/core/IZone.java b/api/buildcraft/api/core/IZone.java index efc9b16..50759a4 100755 --- a/api/buildcraft/api/core/IZone.java +++ b/api/buildcraft/api/core/IZone.java @@ -4,15 +4,16 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; -import java.util.Random; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.Vec3; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import java.util.Random; /** Defines some volume in the world. This is not guaranteed to be fully connected to itself. */ -public interface IZone { +public interface IZone +{ /** Returns the smallest possible distance that the pos would have to be changed by in order for - * {@link #contains(Vec3d)} to return true. If the position is already inside then this will return 0 */ + * {@link #contains(Vec3)} to return true. If the position is already inside then this will return 0 */ double distanceTo(BlockPos pos); /** Returns {@link #distanceTo(BlockPos)} but squared. Usually this will be quicker to calculate. */ @@ -20,8 +21,8 @@ public interface IZone { /** Returns true if the point is enclosed by this zone, such that none of the coordinates lie outside the range * specified by this zone. */ - boolean contains(Vec3d point); + boolean contains(Vec3 point); - /** Gets a random position that {@link #contains(Vec3d)} will return true. */ + /** Gets a random position that {@link #contains(Vec3)} will return true. */ BlockPos getRandomBlockPos(Random rand); } diff --git a/api/buildcraft/api/core/JavaTools.java b/api/buildcraft/api/core/JavaTools.java deleted file mode 100755 index 7b7eb51..0000000 --- a/api/buildcraft/api/core/JavaTools.java +++ /dev/null @@ -1,39 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import java.util.Arrays; - -public final class JavaTools { - private JavaTools() { - - } - - public static T[] concat(T[] first, T[] second) { - T[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static int[] concat(int[] first, int[] second) { - int[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static float[] concat(float[] first, float[] second) { - float[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static String surroundWithQuotes(String stringToSurroundWithQuotes) { - return String.format("\"%s\"", stringToSurroundWithQuotes); - } - - public static String stripSurroundingQuotes(String stringToStripQuotes) { - return stringToStripQuotes.replaceAll("^\"|\"$", ""); - } -} diff --git a/api/buildcraft/api/core/SafeTimeTracker.java b/api/buildcraft/api/core/SafeTimeTracker.java index 30593be..80f9be7 100644 --- a/api/buildcraft/api/core/SafeTimeTracker.java +++ b/api/buildcraft/api/core/SafeTimeTracker.java @@ -4,10 +4,11 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; -import net.minecraft.world.World; +import net.minecraft.world.level.Level; /** Provides a way of tracking time in the world, without requiring manual ticking. */ -public class SafeTimeTracker { +public class SafeTimeTracker +{ private long lastMark = Long.MIN_VALUE; private long duration = -1; @@ -34,17 +35,17 @@ public SafeTimeTracker(long delay, long random) { } /** Return true if the internal delay has passed since last time marked was called successfully. */ - public boolean markTimeIfDelay(World world) { + public boolean markTimeIfDelay(Level world) { return markTimeIfDelay(world, internalDelay); } /** Return true if a given delay has passed since last time marked was called successfully. */ - public boolean markTimeIfDelay(World world, long delay) { + public boolean markTimeIfDelay(Level world, long delay) { if (world == null) { return false; } - long currentTime = world.getTotalWorldTime(); + long currentTime = world.getGameTime(); if (currentTime < lastMark) { lastMark = currentTime; @@ -64,7 +65,7 @@ public long durationOfLastDelay() { return duration > 0 ? duration : 0; } - public void markTime(World world) { - lastMark = world.getTotalWorldTime(); + public void markTime(Level world) { + lastMark = world.getGameTime(); } } diff --git a/api/buildcraft/api/core/StackKey.java b/api/buildcraft/api/core/StackKey.java deleted file mode 100644 index d8c2c44..0000000 --- a/api/buildcraft/api/core/StackKey.java +++ /dev/null @@ -1,124 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -/** This class is used whenever stacks needs to be stored as keys. */ -public final class StackKey { - public final ItemStack stack; - public final FluidStack fluidStack; - - public StackKey(FluidStack fluidStack) { - this(null, fluidStack); - } - - public StackKey(ItemStack stack) { - this(stack, null); - } - - public StackKey(ItemStack stack, FluidStack fluidStack) { - this.stack = stack; - this.fluidStack = fluidStack; - } - - public static StackKey stack(Item item, int amount, int damage) { - return new StackKey(new ItemStack(item, amount, damage)); - } - - public static StackKey stack(Block block, int amount, int damage) { - return new StackKey(new ItemStack(block, amount, damage)); - } - - public static StackKey stack(Item item) { - return new StackKey(new ItemStack(item, 1, 0)); - } - - public static StackKey stack(Block block) { - return new StackKey(new ItemStack(block, 1, 0)); - } - - public static StackKey stack(ItemStack itemStack) { - return new StackKey(itemStack); - } - - public static StackKey fluid(Fluid fluid, int amount) { - return new StackKey(new FluidStack(fluid, amount)); - } - - public static StackKey fluid(Fluid fluid) { - return new StackKey(new FluidStack(fluid, 1000)); - } - - public static StackKey fluid(FluidStack fluidStack) { - return new StackKey(fluidStack); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || o.getClass() != StackKey.class) { - return false; - } - StackKey k = (StackKey) o; - if ((stack == null ^ k.stack == null) || (fluidStack == null ^ k.fluidStack == null)) { - return false; - } - if (stack != null) { - if (stack.getItem() != k.stack.getItem() || stack.getHasSubtypes() && stack.getItemDamage() != k.stack.getItemDamage() || !objectsEqual( - stack.getTagCompound(), k.stack.getTagCompound())) { - return false; - } - } - if (fluidStack != null) { - if (!fluidStack.isFluidEqual(k.fluidStack) || fluidStack.amount != k.fluidStack.amount) { - return false; - } - } - return true; - } - - @Override - public int hashCode() { - int result = 7; - if (stack != null) { - result = 31 * result + stack.getItem().hashCode(); - result = 31 * result + stack.getItemDamage(); - result = 31 * result + objectHashCode(stack.getTagCompound()); - } - result = 31 * result + 7; - if (fluidStack != null) { - result = 31 * result + fluidStack.getFluid().getName().hashCode(); - result = 31 * result + fluidStack.amount; - result = 31 * result + objectHashCode(fluidStack.tag); - } - return result; - } - - private boolean objectsEqual(Object o1, Object o2) { - if (o1 == null && o2 == null) { - return true; - } else if (o1 == null || o2 == null) { - return false; - } else { - return o1.equals(o2); - } - } - - private int objectHashCode(Object o) { - return o != null ? o.hashCode() : 0; - } - - public StackKey copy() { - return new StackKey(stack != null ? stack.copy() : null, fluidStack != null ? fluidStack.copy() : null); - } -} diff --git a/api/buildcraft/api/core/package-info.java b/api/buildcraft/api/core/package-info.java index 223c751..602efd6 100644 --- a/api/buildcraft/api/core/package-info.java +++ b/api/buildcraft/api/core/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.2", owner = "buildcraftlib", provides = "buildcraftapi_core") +//@API(apiVersion = "2.2", owner = "buildcraftlib", provides = "buildcraftapi_core") package buildcraft.api.core; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/core/render/ISprite.java b/api/buildcraft/api/core/render/ISprite.java index 0428a44..66637fe 100644 --- a/api/buildcraft/api/core/render/ISprite.java +++ b/api/buildcraft/api/core/render/ISprite.java @@ -8,7 +8,8 @@ *

* IMPORTANT: Unlike Minecraft's {@link TextureAtlasSprite} this uses co-ordinates between 0 and 1, rather than 0 * and 16! */ -public interface ISprite { +public interface ISprite +{ /** Binds this sprites backing texture so that this sprite will be referenced when you use the results of * {@link #getInterpU(double)} and {@link #getInterpV(double)} */ void bindTexture(); diff --git a/api/buildcraft/api/crops/CropManager.java b/api/buildcraft/api/crops/CropManager.java index 68a4302..53bc05a 100644 --- a/api/buildcraft/api/crops/CropManager.java +++ b/api/buildcraft/api/crops/CropManager.java @@ -3,13 +3,13 @@ import java.util.ArrayList; import java.util.List; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.core.NonNullList; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.state.BlockState; public final class CropManager { private static List handlers = new ArrayList<>(); @@ -40,7 +40,7 @@ public static boolean isSeed(ItemStack stack) { return defaultHandler.isSeed(stack); } - public static boolean canSustainPlant(World world, ItemStack seed, BlockPos pos) { + public static boolean canSustainPlant(Level world, ItemStack seed, BlockPos pos) { for (ICropHandler cropHandler : handlers) { if (cropHandler.isSeed(seed) && cropHandler.canSustainPlant(world, seed, pos)) { return true; @@ -51,8 +51,8 @@ public static boolean canSustainPlant(World world, ItemStack seed, BlockPos pos) /** Attempts to plant the crop given by the seed into the world. Also checks to make sure that * {@link ICropHandler#isSeed(ItemStack)} is true, and - * {@link ICropHandler#canSustainPlant(World, ItemStack, BlockPos)} is true for the position. */ - public static boolean plantCrop(World world, EntityPlayer player, ItemStack seed, BlockPos pos) { + * {@link ICropHandler#canSustainPlant(Level, ItemStack, BlockPos)} is true for the position. */ + public static boolean plantCrop(Level world, Player player, ItemStack seed, BlockPos pos) { for (ICropHandler cropHandler : handlers) { if (cropHandler.isSeed(seed) && cropHandler.canSustainPlant(world, seed, pos) && cropHandler.plantCrop(world, player, seed, pos)) { return true; @@ -64,7 +64,7 @@ public static boolean plantCrop(World world, EntityPlayer player, ItemStack seed return false; } - public static boolean isMature(IBlockAccess blockAccess, IBlockState state, BlockPos pos) { + public static boolean isMature(LevelAccessor blockAccess, BlockState state, BlockPos pos) { for (ICropHandler cropHandler : handlers) { if (cropHandler.isMature(blockAccess, state, pos)) { return true; @@ -73,8 +73,8 @@ public static boolean isMature(IBlockAccess blockAccess, IBlockState state, Bloc return defaultHandler.isMature(blockAccess, state, pos); } - public static boolean harvestCrop(World world, BlockPos pos, NonNullList drops) { - IBlockState state = world.getBlockState(pos); + public static boolean harvestCrop(Level world, BlockPos pos, NonNullList drops) { + BlockState state = world.getBlockState(pos); for (ICropHandler cropHandler : handlers) { if (cropHandler.isMature(world, state, pos)) { return cropHandler.harvestCrop(world, pos, drops); diff --git a/api/buildcraft/api/crops/ICropHandler.java b/api/buildcraft/api/crops/ICropHandler.java index 845108f..199b036 100644 --- a/api/buildcraft/api/crops/ICropHandler.java +++ b/api/buildcraft/api/crops/ICropHandler.java @@ -1,12 +1,12 @@ package buildcraft.api.crops; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.core.NonNullList; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.state.BlockState; public interface ICropHandler { @@ -23,31 +23,31 @@ public interface ICropHandler { * @param seed * @param pos * @return true if the item can be planted at pos. */ - boolean canSustainPlant(World world, ItemStack seed, BlockPos pos); + boolean canSustainPlant(Level world, ItemStack seed, BlockPos pos); - /** Plant the item in the block. You can assume plantCrop() will only be called if canSustainPlant() returned true. + /** Plant the item in the core. You can assume plantCrop() will only be called if canSustainPlant() returned true. * * @param world * @param player * @param seed * @param pos * @return true if the item was planted at pos. */ - boolean plantCrop(World world, EntityPlayer player, ItemStack seed, BlockPos pos); + boolean plantCrop(Level world, Player player, ItemStack seed, BlockPos pos); /** Check if a crop is mature and can be harvested. * * @param blockAccess * @param state * @param pos - * @return true if the block at pos is mature and can be harvested. */ - boolean isMature(IBlockAccess blockAccess, IBlockState state, BlockPos pos); + * @return true if the core at pos is mature and can be harvested. */ + boolean isMature(LevelAccessor blockAccess, BlockState state, BlockPos pos); /** Harvest the crop. You can assume harvestCrop() will only be called if isMature() returned true. * * @param world * @param pos * @param drops a list to return the harvest's drops. - * @return true if the block was successfully harvested. */ - boolean harvestCrop(World world, BlockPos pos, NonNullList drops); + * @return true if the core was successfully harvested. */ + boolean harvestCrop(Level world, BlockPos pos, NonNullList drops); } diff --git a/api/buildcraft/api/crops/package-info.java b/api/buildcraft/api/crops/package-info.java index fcf92d8..e0354cf 100644 --- a/api/buildcraft/api/crops/package-info.java +++ b/api/buildcraft/api/crops/package-info.java @@ -2,7 +2,7 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_crops") +//@API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_crops") package buildcraft.api.crops; -import net.minecraftforge.fml.common.API; +//import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/data/NbtSquishConstants.java b/api/buildcraft/api/data/NbtSquishConstants.java index 6622ace..eeff60e 100644 --- a/api/buildcraft/api/data/NbtSquishConstants.java +++ b/api/buildcraft/api/data/NbtSquishConstants.java @@ -1,13 +1,12 @@ package buildcraft.api.data; -import java.util.zip.GZIPInputStream; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; +import java.util.zip.GZIPInputStream; -public class NbtSquishConstants { +public class NbtSquishConstants +{ /** Default written NBT Tag type- this is provided by - * {@link CompressedStreamTools#write(NBTTagCompound, java.io.DataOutput)} and + * {@link CompressedStreamTools#write(CompoundTag, java.io.DataOutput)} and * {@link CompressedStreamTools#read(java.io.DataInput, net.minecraft.nbt.NBTSizeTracker)}. * * Generally more suited to smaller NBT tags, and it writes fairly quickly. Can quickly use up a lot of space for diff --git a/api/buildcraft/api/enums/EnumDecoratedBlock.java b/api/buildcraft/api/enums/EnumDecoratedBlock.java index 0a6b53f..63348e9 100644 --- a/api/buildcraft/api/enums/EnumDecoratedBlock.java +++ b/api/buildcraft/api/enums/EnumDecoratedBlock.java @@ -1,10 +1,11 @@ package buildcraft.api.enums; -import java.util.Locale; +import net.minecraft.util.StringRepresentable; -import net.minecraft.util.IStringSerializable; +import java.util.Locale; -public enum EnumDecoratedBlock implements IStringSerializable { +public enum EnumDecoratedBlock implements StringRepresentable +{ DESTROY(0), BLUEPRINT(10), TEMPLATE(10), @@ -21,7 +22,7 @@ public enum EnumDecoratedBlock implements IStringSerializable { } @Override - public String getName() { + public String getSerializedName() { return name().toLowerCase(Locale.ROOT); } diff --git a/api/buildcraft/api/enums/EnumEngineType.java b/api/buildcraft/api/enums/EnumEngineType.java index 38cdc62..e788d1d 100644 --- a/api/buildcraft/api/enums/EnumEngineType.java +++ b/api/buildcraft/api/enums/EnumEngineType.java @@ -1,37 +1,85 @@ package buildcraft.api.enums; -import net.minecraft.util.IStringSerializable; - import buildcraft.api.core.IEngineType; +import buildcraft.lib.client.model.ModelHolderVariable; +import buildcraft.lib.client.model.MutableQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.core.Direction; +import net.minecraft.util.StringRepresentable; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -public enum EnumEngineType implements IStringSerializable, IEngineType { +public enum EnumEngineType implements StringRepresentable, IEngineType +{ WOOD("core", "wood"), STONE("energy", "stone"), IRON("energy", "iron"), - CREATIVE("energy", "creative"); + // CREATIVE("energy", "creative"), + CREATIVE("core", "creative"), + ; public final String unlocalizedTag; public final String resourceLocation; public static final EnumEngineType[] VALUES = values(); - EnumEngineType(String mod, String loc) { + // Calen + @OnlyIn(Dist.CLIENT) + private ModelHolderVariable model; + @OnlyIn(Dist.CLIENT) + private TextureAtlasSprite particle; + + EnumEngineType(String mod, String loc) + { unlocalizedTag = loc; resourceLocation = "buildcraft" + mod + ":blocks/engine/inv/" + loc; } + @OnlyIn(Dist.CLIENT) + public void setModel(ModelHolderVariable model) + { + this.model = model; + } + + @OnlyIn(Dist.CLIENT) + public ModelHolderVariable getModel() + { + return model; + } + + @OnlyIn(Dist.CLIENT) + public TextureAtlasSprite getPticle() + { + if (particle == null) + { + for (MutableQuad quad : model.getCutoutQuads()) + { + if (quad.getFace() == Direction.DOWN) + { + particle = quad.getSprite(); + break; + } + } + } + return particle; + } + @Override - public String getItemModelLocation() { + public String getItemModelLocation() + { return resourceLocation; } @Override - public String getName() { + public String getSerializedName() + { return unlocalizedTag; } - public static EnumEngineType fromMeta(int meta) { - if (meta < 0 || meta >= VALUES.length) { + public static EnumEngineType fromMeta(int meta) + { + if (meta < 0 || meta >= VALUES.length) + { meta = 0; } return VALUES[meta]; diff --git a/api/buildcraft/api/enums/EnumExchangePart.java b/api/buildcraft/api/enums/EnumExchangePart.java new file mode 100644 index 0000000..e3f23fb --- /dev/null +++ b/api/buildcraft/api/enums/EnumExchangePart.java @@ -0,0 +1,20 @@ +package buildcraft.api.enums; + +import net.minecraft.util.StringRepresentable; + +import java.util.Locale; + +public enum EnumExchangePart implements StringRepresentable +{ + START, + MIDDLE, + END; + + private final String lowerCaseName = name().toLowerCase(Locale.ROOT); + + @Override + public String getSerializedName() + { + return lowerCaseName; + } +} diff --git a/api/buildcraft/api/enums/EnumLaserTableType.java b/api/buildcraft/api/enums/EnumLaserTableType.java index dbf99a5..ca0610a 100644 --- a/api/buildcraft/api/enums/EnumLaserTableType.java +++ b/api/buildcraft/api/enums/EnumLaserTableType.java @@ -1,8 +1,9 @@ package buildcraft.api.enums; -import net.minecraft.util.IStringSerializable; +import net.minecraft.util.StringRepresentable; -public enum EnumLaserTableType implements IStringSerializable { +public enum EnumLaserTableType implements StringRepresentable +{ ASSEMBLY_TABLE, ADVANCED_CRAFTING_TABLE, INTEGRATION_TABLE, @@ -10,7 +11,7 @@ public enum EnumLaserTableType implements IStringSerializable { PROGRAMMING_TABLE; @Override - public String getName() { + public String getSerializedName() { return name(); } } diff --git a/api/buildcraft/api/enums/EnumMachineState.java b/api/buildcraft/api/enums/EnumMachineState.java index 7b7caf7..4d29931 100644 --- a/api/buildcraft/api/enums/EnumMachineState.java +++ b/api/buildcraft/api/enums/EnumMachineState.java @@ -1,21 +1,21 @@ package buildcraft.api.enums; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.IStringSerializable; - import buildcraft.api.properties.BuildCraftProperties; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.level.block.state.BlockState; -public enum EnumMachineState implements IStringSerializable { +public enum EnumMachineState implements StringRepresentable +{ OFF, ON, DONE; - public static EnumMachineState getType(IBlockState state) { + public static EnumMachineState getType(BlockState state) { return state.getValue(BuildCraftProperties.MACHINE_STATE); } @Override - public String getName() { + public String getSerializedName() { return name(); } } diff --git a/api/buildcraft/api/enums/EnumOptionalSnapshotType.java b/api/buildcraft/api/enums/EnumOptionalSnapshotType.java index cfd413d..4e12537 100644 --- a/api/buildcraft/api/enums/EnumOptionalSnapshotType.java +++ b/api/buildcraft/api/enums/EnumOptionalSnapshotType.java @@ -1,14 +1,15 @@ package buildcraft.api.enums; -import java.util.Locale; +import net.minecraft.util.StringRepresentable; -import net.minecraft.util.IStringSerializable; +import java.util.Locale; /** * Version of {@link EnumSnapshotType} with {@link EnumOptionalSnapshotType#NONE} value. * Shouldn't be used where it's possible to use {@link EnumSnapshotType}. */ -public enum EnumOptionalSnapshotType implements IStringSerializable { +public enum EnumOptionalSnapshotType implements StringRepresentable +{ NONE(null), TEMPLATE(EnumSnapshotType.TEMPLATE), BLUEPRINT(EnumSnapshotType.BLUEPRINT); @@ -34,7 +35,7 @@ public static EnumOptionalSnapshotType fromNullable(EnumSnapshotType type) { } @Override - public String getName() { + public String getSerializedName() { return name().toLowerCase(Locale.ROOT); } } diff --git a/api/buildcraft/api/enums/EnumPowerStage.java b/api/buildcraft/api/enums/EnumPowerStage.java index 0a88bae..399aa31 100644 --- a/api/buildcraft/api/enums/EnumPowerStage.java +++ b/api/buildcraft/api/enums/EnumPowerStage.java @@ -1,10 +1,11 @@ package buildcraft.api.enums; -import java.util.Locale; +import net.minecraft.util.StringRepresentable; -import net.minecraft.util.IStringSerializable; +import java.util.Locale; -public enum EnumPowerStage implements IStringSerializable { +public enum EnumPowerStage implements StringRepresentable +{ BLUE, GREEN, YELLOW, @@ -21,7 +22,7 @@ public String getModelName() { } @Override - public String getName() { + public String getSerializedName() { return getModelName(); } } diff --git a/api/buildcraft/api/enums/EnumRedstoneChipset.java b/api/buildcraft/api/enums/EnumRedstoneChipset.java index 90d7cc4..480a232 100644 --- a/api/buildcraft/api/enums/EnumRedstoneChipset.java +++ b/api/buildcraft/api/enums/EnumRedstoneChipset.java @@ -1,14 +1,17 @@ package buildcraft.api.enums; -import java.util.Locale; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IStringSerializable; +import buildcraft.silicon.BCSiliconItems; +import buildcraft.silicon.item.ItemRedstoneChipset; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.registries.RegistryObject; -import buildcraft.api.BCItems; +import java.util.Locale; -public enum EnumRedstoneChipset implements IStringSerializable { +//public enum EnumRedstoneChipset implements IStringSerializable +public enum EnumRedstoneChipset implements StringRepresentable +{ RED, IRON, GOLD, @@ -17,35 +20,67 @@ public enum EnumRedstoneChipset implements IStringSerializable { private final String name = name().toLowerCase(Locale.ROOT); - public ItemStack getStack(int stackSize) { - Item chipset = BCItems.Silicon.REDSTONE_CHIPSET; - if (chipset == null) { + public ItemStack getStack(int stackSize) + { +// Item chipset = BCItems.Silicon.REDSTONE_CHIPSET; + RegistryObject chipset = BCSiliconItems.chipsetRedstone; + if (chipset == null) + { return ItemStack.EMPTY; } - - return new ItemStack(chipset, stackSize, ordinal()); + // ordinal() -> meta + // 0 红石 + // 1 铁 + // 2 金 + // 3 石英 + // 4 钻石 +// return new ItemStack(chipset, stackSize, ordinal()); + switch (this) + { + case RED: + return new ItemStack(BCSiliconItems.chipsetRedstone.get(), stackSize); + case IRON: + return new ItemStack(BCSiliconItems.chipsetIron.get(), stackSize); + case GOLD: + return new ItemStack(BCSiliconItems.chipsetGold.get(), stackSize); + case QUARTZ: + return new ItemStack(BCSiliconItems.chipsetQuartz.get(), stackSize); + case DIAMOND: + return new ItemStack(BCSiliconItems.chipsetDiamond.get(), stackSize); + default: + return ItemStack.EMPTY; + } } - public ItemStack getStack() { + public ItemStack getStack() + { return getStack(1); } - public static EnumRedstoneChipset fromStack(ItemStack stack) { - if (stack == null) { + public static EnumRedstoneChipset fromStack(ItemStack stack) + { +// if (stack == null) + if (stack == null || stack.getItem().getClass() != ItemRedstoneChipset.class) + { return RED; } - return fromOrdinal(stack.getMetadata()); +// return fromOrdinal(stack.getMetadata()); + return ((ItemRedstoneChipset) stack.getItem()).type; } - public static EnumRedstoneChipset fromOrdinal(int ordinal) { - if (ordinal < 0 || ordinal >= values().length) { + public static EnumRedstoneChipset fromOrdinal(int ordinal) + { + if (ordinal < 0 || ordinal >= values().length) + { return RED; } return values()[ordinal]; } @Override - public String getName() { +// public String getName() + public String getSerializedName() + { return name; } } diff --git a/api/buildcraft/api/enums/EnumSpring.java b/api/buildcraft/api/enums/EnumSpring.java index 21e4cf2..8fe13b8 100644 --- a/api/buildcraft/api/enums/EnumSpring.java +++ b/api/buildcraft/api/enums/EnumSpring.java @@ -1,40 +1,41 @@ package buildcraft.api.enums; -import java.util.Locale; -import java.util.function.Supplier; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IStringSerializable; +import net.minecraft.core.BlockPos; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; -import buildcraft.api.properties.BuildCraftProperties; +import java.util.Locale; +import java.util.function.BiFunction; -public enum EnumSpring implements IStringSerializable { - WATER(5, -1, Blocks.WATER.getDefaultState()), +public enum EnumSpring implements StringRepresentable +{ + WATER(5, -1, Blocks.WATER.defaultBlockState()), OIL(6000, 8, null); // Set in BuildCraftEnergy public static final EnumSpring[] VALUES = values(); public final int tickRate, chance; - public IBlockState liquidBlock; + public BlockState liquidBlock; public boolean canGen = true; - public Supplier tileConstructor; +// public Supplier tileConstructor; + public BiFunction tileConstructor; private final String lowerCaseName = name().toLowerCase(Locale.ROOT); - EnumSpring(int tickRate, int chance, IBlockState liquidBlock) { + EnumSpring(int tickRate, int chance, BlockState liquidBlock) { this.tickRate = tickRate; this.chance = chance; this.liquidBlock = liquidBlock; } - public static EnumSpring fromState(IBlockState state) { - return state.getValue(BuildCraftProperties.SPRING_TYPE); - } +// public static EnumSpring fromState(BlockState state) { +// return state.getValue(BuildCraftProperties.SPRING_TYPE); +// } @Override - public String getName() { + public String getSerializedName() { return lowerCaseName; } } diff --git a/api/buildcraft/api/enums/package-info.java b/api/buildcraft/api/enums/package-info.java index ab21992..c3eb5c7 100644 --- a/api/buildcraft/api/enums/package-info.java +++ b/api/buildcraft/api/enums/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_enums") +//@API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_enums") package buildcraft.api.enums; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/events/BlockInteractionEvent.java b/api/buildcraft/api/events/BlockInteractionEvent.java index 4a4d8b7..e00cdcc 100644 --- a/api/buildcraft/api/events/BlockInteractionEvent.java +++ b/api/buildcraft/api/events/BlockInteractionEvent.java @@ -4,18 +4,19 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.events; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.eventbus.api.Event; @Cancelable -public class BlockInteractionEvent extends Event { - public final EntityPlayer player; - public final IBlockState state; +public class BlockInteractionEvent extends Event +{ + public final Player player; + public final BlockState state; - public BlockInteractionEvent(EntityPlayer player, IBlockState state) { + public BlockInteractionEvent(Player player, BlockState state) { this.player = player; this.state = state; } diff --git a/api/buildcraft/api/events/BlockPlacedDownEvent.java b/api/buildcraft/api/events/BlockPlacedDownEvent.java index 22a8a74..da53618 100644 --- a/api/buildcraft/api/events/BlockPlacedDownEvent.java +++ b/api/buildcraft/api/events/BlockPlacedDownEvent.java @@ -4,20 +4,20 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.events; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.math.BlockPos; - -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.eventbus.api.Event; @Cancelable -public class BlockPlacedDownEvent extends Event { - public final EntityPlayer player; - public final IBlockState state; +public class BlockPlacedDownEvent extends Event +{ + public final Player player; + public final BlockState state; public final BlockPos pos; - public BlockPlacedDownEvent(EntityPlayer player, BlockPos pos, IBlockState state) { + public BlockPlacedDownEvent(Player player, BlockPos pos, BlockState state) { this.player = player; this.state = state; this.pos = pos; diff --git a/api/buildcraft/api/events/PipePlacedEvent.java b/api/buildcraft/api/events/PipePlacedEvent.java index 3664a57..64ba625 100644 --- a/api/buildcraft/api/events/PipePlacedEvent.java +++ b/api/buildcraft/api/events/PipePlacedEvent.java @@ -4,18 +4,18 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.events; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.fml.common.eventhandler.Event; - -public class PipePlacedEvent extends Event { - public EntityPlayer player; +public class PipePlacedEvent extends Event +{ + public Player player; public Item pipeType; public BlockPos pos; - public PipePlacedEvent(EntityPlayer player, Item pipeType, BlockPos pos) { + public PipePlacedEvent(Player player, Item pipeType, BlockPos pos) { this.player = player; this.pipeType = pipeType; this.pos = pos; diff --git a/api/buildcraft/api/events/RobotEvent.java b/api/buildcraft/api/events/RobotEvent.java index 9b12b64..43604d5 100644 --- a/api/buildcraft/api/events/RobotEvent.java +++ b/api/buildcraft/api/events/RobotEvent.java @@ -4,15 +4,14 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.events; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; - import buildcraft.api.robots.EntityRobotBase; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.eventbus.api.Event; -public abstract class RobotEvent extends Event { +public abstract class RobotEvent extends Event +{ public final EntityRobotBase robot; public RobotEvent(EntityRobotBase robot) { @@ -21,9 +20,9 @@ public RobotEvent(EntityRobotBase robot) { @Cancelable public static class Place extends RobotEvent { - public final EntityPlayer player; + public final Player player; - public Place(EntityRobotBase robot, EntityPlayer player) { + public Place(EntityRobotBase robot, Player player) { super(robot); this.player = player; } @@ -31,10 +30,10 @@ public Place(EntityRobotBase robot, EntityPlayer player) { @Cancelable public static class Interact extends RobotEvent { - public final EntityPlayer player; + public final Player player; public final ItemStack item; - public Interact(EntityRobotBase robot, EntityPlayer player, ItemStack item) { + public Interact(EntityRobotBase robot, Player player, ItemStack item) { super(robot); this.player = player; this.item = item; @@ -43,9 +42,9 @@ public Interact(EntityRobotBase robot, EntityPlayer player, ItemStack item) { @Cancelable public static class Dismantle extends RobotEvent { - public final EntityPlayer player; + public final Player player; - public Dismantle(EntityRobotBase robot, EntityPlayer player) { + public Dismantle(EntityRobotBase robot, Player player) { super(robot); this.player = player; } diff --git a/api/buildcraft/api/events/RobotPlacementEvent.java b/api/buildcraft/api/events/RobotPlacementEvent.java index b0abc44..7de1b91 100644 --- a/api/buildcraft/api/events/RobotPlacementEvent.java +++ b/api/buildcraft/api/events/RobotPlacementEvent.java @@ -4,17 +4,17 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.events; -import net.minecraft.entity.player.EntityPlayer; - -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraft.world.entity.player.Player; +import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.eventbus.api.Event; @Cancelable -public class RobotPlacementEvent extends Event { - public EntityPlayer player; +public class RobotPlacementEvent extends Event +{ + public Player player; public String robotProgram; - public RobotPlacementEvent(EntityPlayer player, String robotProgram) { + public RobotPlacementEvent(Player player, String robotProgram) { this.player = player; this.robotProgram = robotProgram; } diff --git a/api/buildcraft/api/events/package-info.java b/api/buildcraft/api/events/package-info.java index 46ac77c..1fc1b49 100644 --- a/api/buildcraft/api/events/package-info.java +++ b/api/buildcraft/api/events/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_events") +//@API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_events") package buildcraft.api.events; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/facades/FacadeAPI.java b/api/buildcraft/api/facades/FacadeAPI.java index 1f3e2b9..73f8d79 100644 --- a/api/buildcraft/api/facades/FacadeAPI.java +++ b/api/buildcraft/api/facades/FacadeAPI.java @@ -1,13 +1,16 @@ package buildcraft.api.facades; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import net.minecraftforge.fml.common.event.FMLInterModComms; - -public final class FacadeAPI { +import buildcraft.silicon.item.ItemPluggableFacade; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtUtils; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.fml.InterModComms; +import net.minecraftforge.registries.RegistryObject; + +public final class FacadeAPI +{ public static final String IMC_MOD_TARGET = "buildcraftsilicon"; public static final String IMC_FACADE_DISABLE = "facade_disable_block"; public static final String IMC_FACADE_CUSTOM = "facade_custom_map_block_item"; @@ -15,27 +18,36 @@ public final class FacadeAPI { public static final String NBT_CUSTOM_BLOCK_META = "block_meta"; public static final String NBT_CUSTOM_ITEM_STACK = "item_stack"; - public static IFacadeItem facadeItem; +// public static IFacadeItem facadeItem; +// public static RegistryObject facadeItem; + public static RegistryObject facadeItem; public static IFacadeRegistry registry; - private FacadeAPI() { + private FacadeAPI() + { } - public static void disableBlock(Block block) { - FMLInterModComms.sendMessage(IMC_MOD_TARGET, IMC_FACADE_DISABLE, block.getRegistryName()); + public static void disableBlock(Block block) + { +// FMLInterModComms.sendMessage(IMC_MOD_TARGET, IMC_FACADE_DISABLE, block.getRegistryName()); + InterModComms.sendTo(IMC_MOD_TARGET, IMC_FACADE_DISABLE, ()->block.getRegistryName()); } - public static void mapStateToStack(IBlockState state, ItemStack stack) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setString(NBT_CUSTOM_BLOCK_REG_KEY, state.getBlock().getRegistryName().toString()); - nbt.setInteger(NBT_CUSTOM_BLOCK_META, state.getBlock().getMetaFromState(state)); - nbt.setTag(NBT_CUSTOM_ITEM_STACK, stack.serializeNBT()); - FMLInterModComms.sendMessage(IMC_MOD_TARGET, IMC_FACADE_CUSTOM, nbt); + public static void mapStateToStack(BlockState state, ItemStack stack) + { + CompoundTag nbt = new CompoundTag(); + nbt.putString(NBT_CUSTOM_BLOCK_REG_KEY, state.getBlock().getRegistryName().toString()); +// nbt.putInt(NBT_CUSTOM_BLOCK_META, state.getBlock().getMetaFromState(state)); + nbt.put(NBT_CUSTOM_BLOCK_META, NbtUtils.writeBlockState(state)); + nbt.put(NBT_CUSTOM_ITEM_STACK, stack.serializeNBT()); +// FMLInterModComms.sendMessage(IMC_MOD_TARGET, IMC_FACADE_CUSTOM, nbt); + InterModComms.sendTo(IMC_MOD_TARGET, IMC_FACADE_CUSTOM, ()->nbt); } - public static boolean isFacadeMessageId(String id) { + public static boolean isFacadeMessageId(String id) + { return IMC_FACADE_CUSTOM.equals(id) // - || IMC_FACADE_DISABLE.equals(id); + || IMC_FACADE_DISABLE.equals(id); } } diff --git a/api/buildcraft/api/facades/IFacadeItem.java b/api/buildcraft/api/facades/IFacadeItem.java index 65c312a..5477caa 100644 --- a/api/buildcraft/api/facades/IFacadeItem.java +++ b/api/buildcraft/api/facades/IFacadeItem.java @@ -4,12 +4,12 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.facades; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemStack; - public interface IFacadeItem { @Nullable @@ -22,7 +22,7 @@ default FacadeType getFacadeType(@Nonnull ItemStack stack) { } @Nonnull - ItemStack getFacadeForBlock(IBlockState state); + ItemStack getFacadeForBlock(BlockState state); /** @param facade The {@link IFacade} instance. NOTE: This MUST be an object returned from * {@link IFacadeRegistry#createBasicFacade(IFacadeState, boolean)} or diff --git a/api/buildcraft/api/facades/IFacadePhasedState.java b/api/buildcraft/api/facades/IFacadePhasedState.java index e576e09..5cbf728 100644 --- a/api/buildcraft/api/facades/IFacadePhasedState.java +++ b/api/buildcraft/api/facades/IFacadePhasedState.java @@ -1,12 +1,12 @@ package buildcraft.api.facades; -import javax.annotation.Nullable; +import net.minecraft.world.item.DyeColor; -import net.minecraft.item.EnumDyeColor; +import javax.annotation.Nullable; public interface IFacadePhasedState { IFacadeState getState(); @Nullable - EnumDyeColor getActiveColor(); + DyeColor getActiveColor(); } diff --git a/api/buildcraft/api/facades/IFacadeRegistry.java b/api/buildcraft/api/facades/IFacadeRegistry.java index c0e53f3..c9cb903 100644 --- a/api/buildcraft/api/facades/IFacadeRegistry.java +++ b/api/buildcraft/api/facades/IFacadeRegistry.java @@ -1,16 +1,15 @@ package buildcraft.api.facades; -import java.util.Collection; +import net.minecraft.world.item.DyeColor; import javax.annotation.Nullable; - -import net.minecraft.item.EnumDyeColor; +import java.util.Collection; public interface IFacadeRegistry { Collection getValidFacades(); - IFacadePhasedState createPhasedState(IFacadeState state, @Nullable EnumDyeColor activeColor); + IFacadePhasedState createPhasedState(IFacadeState state, @Nullable DyeColor activeColor); IFacade createPhasedFacade(IFacadePhasedState[] states, boolean isHollow); diff --git a/api/buildcraft/api/facades/IFacadeState.java b/api/buildcraft/api/facades/IFacadeState.java index cf7ad7f..7c8eaae 100644 --- a/api/buildcraft/api/facades/IFacadeState.java +++ b/api/buildcraft/api/facades/IFacadeState.java @@ -1,12 +1,12 @@ package buildcraft.api.facades; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; public interface IFacadeState { boolean isTransparent(); - IBlockState getBlockState(); + BlockState getBlockState(); ItemStack getRequiredStack(); } diff --git a/api/buildcraft/api/facades/package-info.java b/api/buildcraft/api/facades/package-info.java index ee3094d..1241cec 100644 --- a/api/buildcraft/api/facades/package-info.java +++ b/api/buildcraft/api/facades/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_facades") -package buildcraft.api.facades; +//@API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_facades") +//package buildcraft.api.facades; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/filler/IFilledTemplate.java b/api/buildcraft/api/filler/IFilledTemplate.java index d0b59d4..f9ef05c 100644 --- a/api/buildcraft/api/filler/IFilledTemplate.java +++ b/api/buildcraft/api/filler/IFilledTemplate.java @@ -1,11 +1,13 @@ package buildcraft.api.filler; -import net.minecraft.util.math.BlockPos; + +import net.minecraft.core.BlockPos; /** * Use methods of the interface as much as possible, implementation can do optimizations */ -public interface IFilledTemplate { +public interface IFilledTemplate +{ BlockPos getSize(); default BlockPos getMax() { diff --git a/api/buildcraft/api/filler/IFillerPattern.java b/api/buildcraft/api/filler/IFillerPattern.java index cd23730..db7eb1c 100644 --- a/api/buildcraft/api/filler/IFillerPattern.java +++ b/api/buildcraft/api/filler/IFillerPattern.java @@ -4,14 +4,13 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.filler; -import javax.annotation.Nullable; - -import net.minecraft.util.math.BlockPos; - import buildcraft.api.core.render.ISprite; import buildcraft.api.statements.IStatement; import buildcraft.api.statements.IStatementParameter; import buildcraft.api.statements.containers.IFillerStatementContainer; +import net.minecraft.core.BlockPos; + +import javax.annotation.Nullable; /** A type of statement that is used for filler patterns. */ public interface IFillerPattern extends IStatement { diff --git a/api/buildcraft/api/filler/IFillerPatternShape.java b/api/buildcraft/api/filler/IFillerPatternShape.java index b51e253..0b82f85 100644 --- a/api/buildcraft/api/filler/IFillerPatternShape.java +++ b/api/buildcraft/api/filler/IFillerPatternShape.java @@ -4,14 +4,13 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.filler; -import javax.annotation.Nullable; - -import net.minecraft.world.World; - import buildcraft.api.statements.IStatementParameter; import buildcraft.api.statements.containers.IFillerStatementContainer; +import net.minecraft.world.level.Level; + +import javax.annotation.Nullable; -/** {@code IFillerPattern} independent from {@link World} */ +/** {@code IFillerPattern} independent from {@link Level} */ public interface IFillerPatternShape extends IFillerPattern { /** * @param filledTemplate empty template diff --git a/api/buildcraft/api/filler/IFillerRegistry.java b/api/buildcraft/api/filler/IFillerRegistry.java index fa49cb1..1268db8 100644 --- a/api/buildcraft/api/filler/IFillerRegistry.java +++ b/api/buildcraft/api/filler/IFillerRegistry.java @@ -1,12 +1,10 @@ package buildcraft.api.filler; -import java.util.Collection; +import buildcraft.api.statements.IStatement; +import net.minecraft.core.BlockPos; import javax.annotation.Nullable; - -import net.minecraft.util.math.BlockPos; - -import buildcraft.api.statements.IStatement; +import java.util.Collection; public interface IFillerRegistry { void addPattern(IFillerPattern pattern); diff --git a/api/buildcraft/api/filler/package-info.java b/api/buildcraft/api/filler/package-info.java index d5b3f2a..4d7ea95 100644 --- a/api/buildcraft/api/filler/package-info.java +++ b/api/buildcraft/api/filler/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "5.0", owner = "buildcraftapi_core", provides = "buildcraftapi_filler") +//@API(apiVersion = "5.0", owner = "buildcraftapi_core", provides = "buildcraftapi_filler") package buildcraft.api.filler; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/fuels/EnumCoolantType.java b/api/buildcraft/api/fuels/EnumCoolantType.java new file mode 100644 index 0000000..e301862 --- /dev/null +++ b/api/buildcraft/api/fuels/EnumCoolantType.java @@ -0,0 +1,21 @@ +package buildcraft.api.fuels; + +import java.util.Locale; + +// Calen +public enum EnumCoolantType +{ + FLUID, + SOLID, + ; + + public String getlowerName() + { + return this.name().toLowerCase(Locale.ROOT); + } + + public static EnumCoolantType byName(String name) + { + return valueOf(name.toUpperCase(Locale.ROOT)); + } +} diff --git a/api/buildcraft/api/fuels/ICoolant.java b/api/buildcraft/api/fuels/ICoolant.java index f81a863..a5392e8 100644 --- a/api/buildcraft/api/fuels/ICoolant.java +++ b/api/buildcraft/api/fuels/ICoolant.java @@ -1,16 +1,65 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.fuels; +import buildcraft.api.BCModules; +import buildcraft.energy.recipe.CoolantRecipeSerializer; +import buildcraft.lib.misc.StackUtil; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; import net.minecraftforge.fluids.FluidStack; -public interface ICoolant { - boolean matchesFluid(FluidStack fluid); +public interface ICoolant extends Recipe +{ + public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.ENERGY.getModId(), "coolant"); - /** @param fluid - * @param heat - * @return 0 if the input fluid provides no cooling, or a value greater than 0 if it does. */ - float getDegreesCoolingPerMB(FluidStack fluid, float heat); + public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); + + EnumCoolantType getCoolantType(); + FluidStack getFluid(); + + @Override + default boolean matches(Container inv, Level world) + { + return false; + } + + @Override + default ItemStack assemble(Container inv) + { + return StackUtil.EMPTY; + } + + @Override + default boolean canCraftInDimensions(int width, int height) + { + return true; + } + + @Override + default ItemStack getResultItem() + { + return StackUtil.EMPTY; + } + + @Override + default boolean isSpecial() + { + return true; + } + + @Override + default RecipeSerializer getSerializer() + { + return CoolantRecipeSerializer.INSTANCE; + } + + @Override + default RecipeType getType() + { + return TYPE; + } } diff --git a/api/buildcraft/api/fuels/ICoolantManager.java b/api/buildcraft/api/fuels/ICoolantManager.java index dfcf78b..dc13799 100644 --- a/api/buildcraft/api/fuels/ICoolantManager.java +++ b/api/buildcraft/api/fuels/ICoolantManager.java @@ -1,36 +1,52 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** + * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ + * should be located as "LICENSE.API" in the BuildCraft source code distribution. + */ package buildcraft.api.fuels; -import java.util.Collection; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.Fluid; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.material.Fluid; import net.minecraftforge.fluids.FluidStack; -public interface ICoolantManager { - ICoolant addCoolant(ICoolant coolant); +import java.util.Collection; + +public interface ICoolantManager +{ +// IFluidCoolant addCoolant(IFluidCoolant coolant); + IFluidCoolant addUnregisteredFluidCoolant(IFluidCoolant coolant); - ICoolant addCoolant(FluidStack fluid, float degreesCoolingPerMb); + // IFluidCoolant addCoolant(FluidStack fluid, float degreesCoolingPerMb); + IFluidCoolant addCoolant(ResourceLocation id, FluidStack fluid, float degreesCoolingPerMb); - default ICoolant addCoolant(Fluid fluid, float degreesCoolingPerMb) { - return addCoolant(new FluidStack(fluid, 1), degreesCoolingPerMb); + // default IFluidCoolant addCoolant(Fluid fluid, float degreesCoolingPerMb) + default IFluidCoolant addCoolant(ResourceLocation id, Fluid fluid, float degreesCoolingPerMb) + { +// return addCoolant(new FluidStack(fluid, 1), degreesCoolingPerMb); + return addCoolant(id, new FluidStack(fluid, 1), degreesCoolingPerMb); } - ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); +// ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); + ISolidCoolant addUnregisteredSolidCoolant(ISolidCoolant solidCoolant); - ISolidCoolant addSolidCoolant(ItemStack solid, FluidStack fluid, float multiplier); + // ISolidCoolant addSolidCoolant(ItemStack solid, FluidStack fluid, float multiplier); + ISolidCoolant addSolidCoolant(ResourceLocation id, ItemStack solid, FluidStack fluid, float multiplier); - Collection getCoolants(); +// Collection getCoolants(); + Collection getCoolants(Level world); - Collection getSolidCoolants(); +// Collection getSolidCoolants(); + Collection getSolidCoolants(Level world); - ICoolant getCoolant(FluidStack fluid); +// IFluidCoolant getCoolant(FluidStack fluid); + IFluidCoolant getCoolant(Level world, FluidStack fluid); - float getDegreesPerMb(FluidStack fluid, float heat); +// float getDegreesPerMb(FluidStack fluid, float heat); + float getDegreesPerMb(Level world, FluidStack fluid, float heat); - ISolidCoolant getSolidCoolant(ItemStack solid); +// ISolidCoolant getSolidCoolant(ItemStack solid); + ISolidCoolant getSolidCoolant(Level world, ItemStack solid); } diff --git a/api/buildcraft/api/fuels/IFluidCoolant.java b/api/buildcraft/api/fuels/IFluidCoolant.java new file mode 100644 index 0000000..3442e1c --- /dev/null +++ b/api/buildcraft/api/fuels/IFluidCoolant.java @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

+ * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. + */ +package buildcraft.api.fuels; + +import net.minecraftforge.fluids.FluidStack; + +// Calen: ICoolant 1.12.2 -> IFluidCoolant 1.18.2 +// 1.18.2 new class ICoolant super ICoolant, IFluidCoolant +//public interface ICoolant +public interface IFluidCoolant extends ICoolant +{ + boolean matchesFluid(FluidStack fluid); + + /** @param fluid + * @param heat + * @return 0 if the input fluid provides no cooling, or a value greater than 0 if it does. */ + float getDegreesCoolingPerMB(FluidStack fluid, float heat); + float getDegreesCoolingPerMB(); +} diff --git a/api/buildcraft/api/fuels/IFuel.java b/api/buildcraft/api/fuels/IFuel.java index 382eb2a..240b56f 100644 --- a/api/buildcraft/api/fuels/IFuel.java +++ b/api/buildcraft/api/fuels/IFuel.java @@ -1,13 +1,29 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** + * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ + * should be located as "LICENSE.API" in the BuildCraft source code distribution. + */ package buildcraft.api.fuels; +import buildcraft.api.BCModules; +import buildcraft.lib.misc.StackUtil; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; import net.minecraftforge.fluids.FluidStack; -public interface IFuel { - /** @return The input fluid. The {@link FluidStack#amount} is ignored. */ +//public interface IFuel +public interface IFuel extends Recipe +{ + public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.ENERGY.getModId(), "fuel"); + + public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); + + /** @return The input fluid. The {@link FluidStack#getAmount()} is ignored. */ FluidStack getFluid(); /** @return The number of ticks that a single bucket (1000mb) of this fuel will burn for. */ @@ -15,4 +31,50 @@ public interface IFuel { /** @return The amount (in micro mj) of power that this fuel will give off in 1 tick. */ long getPowerPerCycle(); + + @Override + default boolean matches(Container inv, Level world) + { + return false; + } + + @Override + default ItemStack assemble(Container inv) + { + return StackUtil.EMPTY; + } + + @Override + default boolean canCraftInDimensions(int width, int height) + { + return true; + } + + @Override + default ItemStack getResultItem() + { + return StackUtil.EMPTY; + } + + @Override + default boolean isSpecial() + { + return true; + } + + // Calen + @Override + default RecipeType getType() + { + return TYPE; + } + +// @Override +// public NonNullList getIngredients() +// { +// NonNullList nonnulllist = NonNullList.create(); +// nonnulllist.add(Ingredient.of); +// nonnulllist.add(this.middleInput); +// nonnulllist.add(this.bottomOptional); +// return nonnulllist; } diff --git a/api/buildcraft/api/fuels/IFuelManager.java b/api/buildcraft/api/fuels/IFuelManager.java index cb02063..55b5ed5 100644 --- a/api/buildcraft/api/fuels/IFuelManager.java +++ b/api/buildcraft/api/fuels/IFuelManager.java @@ -1,37 +1,61 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** + * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ + * should be located as "LICENSE.API" in the BuildCraft source code distribution. + */ package buildcraft.api.fuels; -import java.util.Collection; - -import net.minecraftforge.fluids.Fluid; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.material.Fluid; import net.minecraftforge.fluids.FluidStack; -public interface IFuelManager { - F addFuel(F fuel); +import java.util.Collection; - IFuel addFuel(FluidStack fluid, long powerPerCycle, int totalBurningTime); +public interface IFuelManager +{ + // F addFuel(F fuel); + F addUnregisteredFuel(F fuel); - default IFuel addFuel(Fluid fluid, long powerPerCycle, int totalBurningTime) { - return addFuel(new FluidStack(fluid, 1), powerPerCycle, totalBurningTime); - } + // IFuel addFuel(FluidStack fluid, long powerPerCycle, int totalBurningTime); + IFuel addUnregisteredFuel(ResourceLocation id, FluidStack fluid, long powerPerCycle, int totalBurningTime); - /** @param residue The residue fluidstack, per bucket of the original fuel. */ - IDirtyFuel addDirtyFuel(FluidStack fuel, long powerPerCycle, int totalBurningTime, FluidStack residue); + // default IFuel addFuel(Fluid fluid, long powerPerCycle, int totalBurningTime) + default IFuel addUnregisteredFuel(ResourceLocation id, Fluid fluid, long powerPerCycle, int totalBurningTime) + { +// return addFuel(new FluidStack(fluid, 1), powerPerCycle, totalBurningTime); + return addUnregisteredFuel(id, new FluidStack(fluid, 1), powerPerCycle, totalBurningTime); + } - /** @param residue The residue fluidstack, per bucket of the original fuel. */ - default IDirtyFuel addDirtyFuel(Fluid fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) { - return addDirtyFuel(new FluidStack(fuel, 1), powerPerCycle, totalBurningTime, residue); + /** + * @param residue The residue fluidstack, per bucket of the original fuel. + */ +// IDirtyFuel addDirtyFuel(FluidStack fuel, long powerPerCycle, int totalBurningTime, FluidStack residue); +// IDirtyFuel addDirtyFuel(ResourceLocation id, FluidStack fuel, long powerPerCycle, int totalBurningTime, FluidStack residue); + IDirtyFuel addUnregisteredDirtyFuel(ResourceLocation id, FluidStack fuel, long powerPerCycle, int totalBurningTime, FluidStack residue); + + /** + * @param residue The residue fluidstack, per bucket of the original fuel. + */ +// default IDirtyFuel addDirtyFuel(Fluid fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) + default IDirtyFuel addUnregisteredDirtyFuel(ResourceLocation id, Fluid fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) + { +// return addDirtyFuel(new FluidStack(fuel, 1), powerPerCycle, totalBurningTime, residue); + return addUnregisteredDirtyFuel(id, new FluidStack(fuel, 1), powerPerCycle, totalBurningTime, residue); } - Collection getFuels(); + // Collection getFuels(); + Collection getFuels(Level world); - IFuel getFuel(FluidStack fluid); + // IFuel getFuel(FluidStack fluid); + IFuel getFuel(Level world, FluidStack fluid); - interface IDirtyFuel extends IFuel { - /** @return The residue fluidstack, per bucket of original fuel. */ + interface IDirtyFuel extends IFuel + { + /** + * @return The residue fluidstack, per bucket of original fuel. + */ FluidStack getResidue(); } } diff --git a/api/buildcraft/api/fuels/ISolidCoolant.java b/api/buildcraft/api/fuels/ISolidCoolant.java index 2b466ef..6554830 100644 --- a/api/buildcraft/api/fuels/ISolidCoolant.java +++ b/api/buildcraft/api/fuels/ISolidCoolant.java @@ -1,13 +1,20 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** + * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ + * should be located as "LICENSE.API" in the BuildCraft source code distribution. + */ package buildcraft.api.fuels; -import net.minecraft.item.ItemStack; - +import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -public interface ISolidCoolant { +public interface ISolidCoolant extends ICoolant +{ FluidStack getFluidFromSolidCoolant(ItemStack stack); + + // Calen + float getMultiplierForSerialize(); + + ItemStack getSolid(); } diff --git a/api/buildcraft/api/fuels/package-info.java b/api/buildcraft/api/fuels/package-info.java index b108eae..61f1829 100644 --- a/api/buildcraft/api/fuels/package-info.java +++ b/api/buildcraft/api/fuels/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_fuels") +//@API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_fuels") package buildcraft.api.fuels; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/gates/IGate.java b/api/buildcraft/api/gates/IGate.java index 2d9302c..0350649 100644 --- a/api/buildcraft/api/gates/IGate.java +++ b/api/buildcraft/api/gates/IGate.java @@ -4,14 +4,14 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.gates; -import java.util.List; - import buildcraft.api.statements.IStatement; import buildcraft.api.statements.IStatementParameter; import buildcraft.api.statements.StatementSlot; import buildcraft.api.statements.containers.ISidedStatementContainer; import buildcraft.api.transport.pipe.IPipeHolder; +import java.util.List; + public interface IGate extends ISidedStatementContainer { IPipeHolder getPipeHolder(); diff --git a/api/buildcraft/api/gates/package-info.java b/api/buildcraft/api/gates/package-info.java index 63d9988..309dd4b 100644 --- a/api/buildcraft/api/gates/package-info.java +++ b/api/buildcraft/api/gates/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "4.1", owner = "buildcraftapi_core", provides = "buildcraftapi_gates") +//@API(apiVersion = "4.1", owner = "buildcraftapi_core", provides = "buildcraftapi_gates") package buildcraft.api.gates; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/imc/BcImcMessage.java b/api/buildcraft/api/imc/BcImcMessage.java new file mode 100644 index 0000000..b417564 --- /dev/null +++ b/api/buildcraft/api/imc/BcImcMessage.java @@ -0,0 +1,41 @@ +package buildcraft.api.imc; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; + +import javax.annotation.Nonnull; + +// Calen: from 1.12.2 forge +public class BcImcMessage +{ + @Nonnull + public final String key; + @Nonnull + private final Object value; + + public BcImcMessage(@Nonnull String key, @Nonnull Object value) + { + this.key = key; + this.value = value; + } + + public ResourceLocation getResourceLocationValue() + { + return (ResourceLocation) value; + } + + public CompoundTag getNBTValue() + { + return (CompoundTag) value; + } + + public boolean isNBTMessage() + { + return CompoundTag.class.isAssignableFrom(getMessageType()); + } + + public Class getMessageType() + { + return value.getClass(); + } +} \ No newline at end of file diff --git a/api/buildcraft/api/inventory/IItemHandlerFiltered.java b/api/buildcraft/api/inventory/IItemHandlerFiltered.java index 8672d1d..919d212 100644 --- a/api/buildcraft/api/inventory/IItemHandlerFiltered.java +++ b/api/buildcraft/api/inventory/IItemHandlerFiltered.java @@ -1,7 +1,6 @@ package buildcraft.api.inventory; -import net.minecraft.item.ItemStack; - +import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandler; /** A type of {@link IItemHandler} that has a single valid stack per slot, as specified by {@link #getFilter(int)}. Note diff --git a/api/buildcraft/api/inventory/IItemTransactor.java b/api/buildcraft/api/inventory/IItemTransactor.java index 212d2e3..87c2d2b 100644 --- a/api/buildcraft/api/inventory/IItemTransactor.java +++ b/api/buildcraft/api/inventory/IItemTransactor.java @@ -1,13 +1,12 @@ package buildcraft.api.inventory; +import buildcraft.api.core.IStackFilter; +import net.minecraft.core.NonNullList; +import net.minecraft.world.item.ItemStack; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; - -import buildcraft.api.core.IStackFilter; - /** A simple way to define something that deals with item insertion and extraction, without caring about slots. */ public interface IItemTransactor { /** @param stack The stack to insert. Must not be null! diff --git a/api/buildcraft/api/items/FluidItemDrops.java b/api/buildcraft/api/items/FluidItemDrops.java index de82f18..0bf4877 100644 --- a/api/buildcraft/api/items/FluidItemDrops.java +++ b/api/buildcraft/api/items/FluidItemDrops.java @@ -1,19 +1,20 @@ package buildcraft.api.items; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; - +import buildcraft.core.item.ItemFragileFluidContainer; +import net.minecraft.core.NonNullList; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidTank; +import net.minecraftforge.registries.RegistryObject; -public class FluidItemDrops { - - public static IItemFluidShard item; +public class FluidItemDrops +{ + public static RegistryObject item; public static void addFluidDrops(NonNullList toDrop, FluidStack... fluids) { if (item != null) { for (FluidStack fluid : fluids) { - item.addFluidDrops(toDrop, fluid); + item.get().addFluidDrops(toDrop, fluid); } } } @@ -21,7 +22,7 @@ public static void addFluidDrops(NonNullList toDrop, FluidStack... fl public static void addFluidDrops(NonNullList toDrop, IFluidTank... tanks) { if (item != null) { for (IFluidTank tank : tanks) { - item.addFluidDrops(toDrop, tank.getFluid()); + item.get().addFluidDrops(toDrop, tank.getFluid()); } } } diff --git a/api/buildcraft/api/items/IItemCustomPipeRender.java b/api/buildcraft/api/items/IItemCustomPipeRender.java deleted file mode 100644 index 697b875..0000000 --- a/api/buildcraft/api/items/IItemCustomPipeRender.java +++ /dev/null @@ -1,14 +0,0 @@ -package buildcraft.api.items; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IItemCustomPipeRender { - float getPipeRenderScale(ItemStack stack); - - /** @return False to use the default renderer, true otherwise. */ - @SideOnly(Side.CLIENT) - boolean renderItemInPipe(ItemStack stack, double x, double y, double z); -} diff --git a/api/buildcraft/api/items/IItemFluidShard.java b/api/buildcraft/api/items/IItemFluidShard.java index 0557f6b..2f1df7d 100644 --- a/api/buildcraft/api/items/IItemFluidShard.java +++ b/api/buildcraft/api/items/IItemFluidShard.java @@ -1,12 +1,12 @@ package buildcraft.api.items; -import javax.annotation.Nullable; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; - +import net.minecraft.core.NonNullList; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -public interface IItemFluidShard { +import javax.annotation.Nullable; + +public interface IItemFluidShard +{ void addFluidDrops(NonNullList toDrop, @Nullable FluidStack fluid); } diff --git a/api/buildcraft/api/items/IList.java b/api/buildcraft/api/items/IList.java index 1456d24..edcf1b0 100644 --- a/api/buildcraft/api/items/IList.java +++ b/api/buildcraft/api/items/IList.java @@ -1,8 +1,8 @@ package buildcraft.api.items; -import javax.annotation.Nonnull; +import net.minecraft.world.item.ItemStack; -import net.minecraft.item.ItemStack; +import javax.annotation.Nonnull; public interface IList extends INamedItem { boolean matches(@Nonnull ItemStack stackList, @Nonnull ItemStack item); diff --git a/api/buildcraft/api/items/IMapLocation.java b/api/buildcraft/api/items/IMapLocation.java index cb5dba5..080103e 100644 --- a/api/buildcraft/api/items/IMapLocation.java +++ b/api/buildcraft/api/items/IMapLocation.java @@ -1,15 +1,13 @@ package buildcraft.api.items; -import java.util.List; - -import javax.annotation.Nonnull; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; - import buildcraft.api.core.IBox; import buildcraft.api.core.IZone; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemStack; + +import javax.annotation.Nonnull; +import java.util.List; /** Created by asie on 2/28/15. */ public interface IMapLocation extends INamedItem { @@ -25,7 +23,7 @@ enum MapLocationType { public final int meta = ordinal(); public static MapLocationType getFromStack(@Nonnull ItemStack stack) { - int dam = stack.getItemDamage(); + int dam = stack.getDamageValue(); if (dam < 0 || dam >= values().length) { return MapLocationType.CLEAN; } @@ -33,7 +31,7 @@ public static MapLocationType getFromStack(@Nonnull ItemStack stack) { } public void setToStack(@Nonnull ItemStack stack) { - stack.setItemDamage(meta); + stack.setDamageValue(meta); } } @@ -65,5 +63,5 @@ public void setToStack(@Nonnull ItemStack stack) { * * @param stack * @return The side of the spot. */ - EnumFacing getPointSide(@Nonnull ItemStack stack); + Direction getPointSide(@Nonnull ItemStack stack); } diff --git a/api/buildcraft/api/items/INamedItem.java b/api/buildcraft/api/items/INamedItem.java index 87c3420..4f220f9 100644 --- a/api/buildcraft/api/items/INamedItem.java +++ b/api/buildcraft/api/items/INamedItem.java @@ -1,11 +1,14 @@ package buildcraft.api.items; -import javax.annotation.Nonnull; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; -import net.minecraft.item.ItemStack; +import javax.annotation.Nonnull; -public interface INamedItem { - String getName(@Nonnull ItemStack stack); +public interface INamedItem +{ +// Component getName(@Nonnull ItemStack stack); + String getName_INamedItem(@Nonnull ItemStack stack); boolean setName(@Nonnull ItemStack stack, String name); } diff --git a/api/buildcraft/api/items/package-info.java b/api/buildcraft/api/items/package-info.java index 883db47..f8bc472 100644 --- a/api/buildcraft/api/items/package-info.java +++ b/api/buildcraft/api/items/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_items") +//@API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_items") package buildcraft.api.items; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/library/ILibraryTypeHandler.java b/api/buildcraft/api/library/ILibraryTypeHandler.java deleted file mode 100644 index 8616d10..0000000 --- a/api/buildcraft/api/library/ILibraryTypeHandler.java +++ /dev/null @@ -1,18 +0,0 @@ -package buildcraft.api.library; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public interface ILibraryTypeHandler { - boolean isHandler(ItemStack stack, boolean store); - - String getFileExtension(); - - int getTextColor(); - - String getName(ItemStack stack); - - ItemStack load(ItemStack stack, NBTTagCompound compound); - - boolean store(ItemStack stack, NBTTagCompound compound); -} diff --git a/api/buildcraft/api/library/LibraryAPI.java b/api/buildcraft/api/library/LibraryAPI.java deleted file mode 100644 index b899793..0000000 --- a/api/buildcraft/api/library/LibraryAPI.java +++ /dev/null @@ -1,30 +0,0 @@ -package buildcraft.api.library; - -import java.util.HashSet; -import java.util.Set; - -@Deprecated -public final class LibraryAPI { - private static final Set handlers = new HashSet<>(); - - private LibraryAPI() { - - } - - public static Set getHandlerSet() { - return handlers; - } - - public static void registerHandler(LibraryTypeHandler handler) { - handlers.add(handler); - } - - public static LibraryTypeHandler getHandlerFor(String extension) { - for (LibraryTypeHandler h : handlers) { - if (h.isInputExtension(extension)) { - return h; - } - } - return null; - } -} diff --git a/api/buildcraft/api/library/LibraryTypeHandler.java b/api/buildcraft/api/library/LibraryTypeHandler.java deleted file mode 100644 index 08db4f6..0000000 --- a/api/buildcraft/api/library/LibraryTypeHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -package buildcraft.api.library; - -import net.minecraft.item.ItemStack; - -@Deprecated -public abstract class LibraryTypeHandler { - public enum HandlerType { - LOAD, - STORE - } - - private final String extension; - - public LibraryTypeHandler(String extension) { - this.extension = extension; - } - - public abstract boolean isHandler(ItemStack stack, HandlerType type); - - public boolean isInputExtension(String ext) { - return extension.equals(ext); - } - - public String getOutputExtension() { - return extension; - } - - public abstract int getTextColor(); - - public abstract String getName(ItemStack stack); -} diff --git a/api/buildcraft/api/library/LibraryTypeHandlerByteArray.java b/api/buildcraft/api/library/LibraryTypeHandlerByteArray.java deleted file mode 100644 index c7c5e23..0000000 --- a/api/buildcraft/api/library/LibraryTypeHandlerByteArray.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.library; - -import net.minecraft.item.ItemStack; - -public abstract class LibraryTypeHandlerByteArray extends LibraryTypeHandler { - public LibraryTypeHandlerByteArray(String extension) { - super(extension); - } - - public abstract ItemStack load(ItemStack stack, byte[] data); - - public abstract byte[] store(ItemStack stack); -} diff --git a/api/buildcraft/api/library/LibraryTypeHandlerNBT.java b/api/buildcraft/api/library/LibraryTypeHandlerNBT.java deleted file mode 100644 index a656ff7..0000000 --- a/api/buildcraft/api/library/LibraryTypeHandlerNBT.java +++ /dev/null @@ -1,14 +0,0 @@ -package buildcraft.api.library; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public abstract class LibraryTypeHandlerNBT extends LibraryTypeHandler { - public LibraryTypeHandlerNBT(String extension) { - super(extension); - } - - public abstract ItemStack load(ItemStack stack, NBTTagCompound nbt); - - public abstract boolean store(ItemStack stack, NBTTagCompound nbt); -} diff --git a/api/buildcraft/api/library/package-info.java b/api/buildcraft/api/library/package-info.java deleted file mode 100644 index ecf627f..0000000 --- a/api/buildcraft/api/library/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_library") -package buildcraft.api.library; - -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/lists/ListMatchHandler.java b/api/buildcraft/api/lists/ListMatchHandler.java index e35a680..bd117c7 100644 --- a/api/buildcraft/api/lists/ListMatchHandler.java +++ b/api/buildcraft/api/lists/ListMatchHandler.java @@ -1,11 +1,11 @@ package buildcraft.api.lists; +import net.minecraft.core.NonNullList; +import net.minecraft.world.item.ItemStack; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; - public abstract class ListMatchHandler { public enum Type { TYPE, diff --git a/api/buildcraft/api/lists/ListRegistry.java b/api/buildcraft/api/lists/ListRegistry.java index 38a9166..08e62ae 100644 --- a/api/buildcraft/api/lists/ListRegistry.java +++ b/api/buildcraft/api/lists/ListRegistry.java @@ -1,11 +1,11 @@ package buildcraft.api.lists; +import net.minecraft.world.item.Item; + import java.util.ArrayList; import java.util.Collections; import java.util.List; -import net.minecraft.item.Item; - public final class ListRegistry { public static final List> itemClassAsType = new ArrayList<>(); private static final List handlers = new ArrayList<>(); diff --git a/api/buildcraft/api/lists/package-info.java b/api/buildcraft/api/lists/package-info.java index b953535..fae9cc7 100644 --- a/api/buildcraft/api/lists/package-info.java +++ b/api/buildcraft/api/lists/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_lists") +//@API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_lists") package buildcraft.api.lists; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/mj/ILaserTarget.java b/api/buildcraft/api/mj/ILaserTarget.java index e1fbfb4..781a8a4 100644 --- a/api/buildcraft/api/mj/ILaserTarget.java +++ b/api/buildcraft/api/mj/ILaserTarget.java @@ -4,10 +4,14 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.mj; +import java.lang.annotation.Inherited; + /** This interface should be defined by any Tile which wants to receive power from BuildCraft lasers. * * The respective Block MUST implement ILaserTargetBlock! */ -public interface ILaserTarget { +//@ILaserTargetAnnotation // Calen +public interface ILaserTarget +{ /** Returns The amount of power this target currently needs. * diff --git a/api/buildcraft/api/mj/ILaserTargetBlock.java b/api/buildcraft/api/mj/ILaserTargetBlock.java index 3e511f7..9366b66 100644 --- a/api/buildcraft/api/mj/ILaserTargetBlock.java +++ b/api/buildcraft/api/mj/ILaserTargetBlock.java @@ -7,6 +7,7 @@ /** This is a marker interface for laser targets. Implement it on your Block. * * It is used by BuildCraft Lasers for optimization purposes. */ -public interface ILaserTargetBlock { +public interface ILaserTargetBlock +{ } diff --git a/api/buildcraft/api/mj/IMjConnector.java b/api/buildcraft/api/mj/IMjConnector.java index 3c5f997..b5670fc 100644 --- a/api/buildcraft/api/mj/IMjConnector.java +++ b/api/buildcraft/api/mj/IMjConnector.java @@ -3,9 +3,10 @@ import javax.annotation.Nonnull; /** Signifies that this should visibly connect to other Mj handling entities/tiles. This should NEVER be the tile - * entity, but an encapsulated class that refers back to it. Use {@link buildcraft.api.mj.MjAPI#CAP_CONNECTOR} to access + * entity, but an encapsulated class that refers back to it. Use {@link MjAPI#CAP_CONNECTOR} to access * this. */ -public interface IMjConnector { +public interface IMjConnector +{ /** Checks to see if this connector can connect to the other connector. By default this should check that the other * connector is the same power system. * diff --git a/api/buildcraft/api/mj/IMjEffectManager.java b/api/buildcraft/api/mj/IMjEffectManager.java index c7fb899..62780a5 100644 --- a/api/buildcraft/api/mj/IMjEffectManager.java +++ b/api/buildcraft/api/mj/IMjEffectManager.java @@ -1,15 +1,16 @@ package buildcraft.api.mj; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; /** Various effects for showing power loss visibly, and for large amounts of power, causes some damage to nearby * entities. */ -public interface IMjEffectManager { - void createPowerLossEffect(World world, Vec3d center, long microJoulesLost); +public interface IMjEffectManager +{ + void createPowerLossEffect(Level world, Vec3 center, long microJoulesLost); - void createPowerLossEffect(World world, Vec3d center, EnumFacing direction, long microJoulesLost); + void createPowerLossEffect(Level world, Vec3 center, Direction direction, long microJoulesLost); - void createPowerLossEffect(World world, Vec3d center, Vec3d direction, long microJoulesLost); + void createPowerLossEffect(Level world, Vec3 center, Vec3 direction, long microJoulesLost); } diff --git a/api/buildcraft/api/mj/MjAPI.java b/api/buildcraft/api/mj/MjAPI.java index 1ed476e..5e22e96 100644 --- a/api/buildcraft/api/mj/MjAPI.java +++ b/api/buildcraft/api/mj/MjAPI.java @@ -1,18 +1,21 @@ package buildcraft.api.mj; -import java.text.DecimalFormat; +import buildcraft.api.BCModules; +import buildcraft.core.BCCore; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.capabilities.*; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; import javax.annotation.Nonnull; +import java.text.DecimalFormat; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - -import net.minecraftforge.common.capabilities.Capability; - -import buildcraft.api.core.CapabilitiesHelper; - -public class MjAPI { +@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = BCCore.MOD_ID) +public class MjAPI +{ // ################################ // @@ -20,12 +23,18 @@ public class MjAPI { // // ################################ - /** A single minecraft joule, in micro joules (the power system base unit) */ + /** + * A single minecraft joule, in micro joules (the power system base unit) + */ public static final long ONE_MINECRAFT_JOULE = getMjValue(); - /** The same as {@link #ONE_MINECRAFT_JOULE}, but a shorter field name */ + /** + * The same as {@link #ONE_MINECRAFT_JOULE}, but a shorter field name + */ public static final long MJ = ONE_MINECRAFT_JOULE; - /** The decimal format used to display values of MJ to the player. Note that this */ + /** + * The decimal format used to display values of MJ to the player. Note that this + */ public static final DecimalFormat MJ_DISPLAY_FORMAT = new DecimalFormat("#,##0.##"); public static IMjEffectManager EFFECT_MANAGER = NullaryEffectManager.INSTANCE; @@ -36,12 +45,16 @@ public class MjAPI { // // ############### - /** Formats a given MJ value to a player-oriented string. Note that this does not append "MJ" to the value. */ - public static String formatMj(long microMj) { + /** + * Formats a given MJ value to a player-oriented string. Note that this does not append "MJ" to the value. + */ + public static String formatMj(long microMj) + { return formatMjInternal(microMj / (double) MJ); } - private static String formatMjInternal(double val) { + private static String formatMjInternal(double val) + { return MJ_DISPLAY_FORMAT.format(val); } @@ -51,16 +64,24 @@ private static String formatMjInternal(double val) { // // ######################################## - public enum NullaryEffectManager implements IMjEffectManager { + public enum NullaryEffectManager implements IMjEffectManager + { INSTANCE; + @Override - public void createPowerLossEffect(World world, Vec3d center, long microJoulesLost) {} + public void createPowerLossEffect(Level world, Vec3 center, long microJoulesLost) + { + } @Override - public void createPowerLossEffect(World world, Vec3d center, EnumFacing direction, long microJoulesLost) {} + public void createPowerLossEffect(Level world, Vec3 center, Direction direction, long microJoulesLost) + { + } @Override - public void createPowerLossEffect(World world, Vec3d center, Vec3d direction, long microJoulesLost) {} + public void createPowerLossEffect(Level world, Vec3 center, Vec3 direction, long microJoulesLost) + { + } } // @formatter:on @@ -71,29 +92,80 @@ public void createPowerLossEffect(World world, Vec3d center, Vec3d direction, lo // ############### @Nonnull - public static final Capability CAP_CONNECTOR; + public static final Capability CAP_CONNECTOR = CapabilityManager.get(new CapabilityToken<>() + { + }); + public static final ResourceLocation CAP_CONNECTOR_ID = new ResourceLocation(BCModules.CORE.getModId(), "mj_connector"); @Nonnull - public static final Capability CAP_RECEIVER; + public static final Capability CAP_RECEIVER = CapabilityManager.get(new CapabilityToken<>() + { + }); + public static final ResourceLocation CAP_RECEIVER_ID = new ResourceLocation(BCModules.CORE.getModId(), "mj_receiver"); @Nonnull - public static final Capability CAP_REDSTONE_RECEIVER; + public static final Capability CAP_REDSTONE_RECEIVER = CapabilityManager.get(new CapabilityToken<>() + { + }); @Nonnull - public static final Capability CAP_READABLE; + public static final Capability CAP_READABLE = CapabilityManager.get(new CapabilityToken<>() + { + }); @Nonnull - public static final Capability CAP_PASSIVE_PROVIDER; - - static { - CAP_CONNECTOR = CapabilitiesHelper.registerCapability(IMjConnector.class); - CAP_RECEIVER = CapabilitiesHelper.registerCapability(IMjReceiver.class); - CAP_REDSTONE_RECEIVER = CapabilitiesHelper.registerCapability(IMjRedstoneReceiver.class); - CAP_READABLE = CapabilitiesHelper.registerCapability(IMjReadable.class); - CAP_PASSIVE_PROVIDER = CapabilitiesHelper.registerCapability(IMjPassiveProvider.class); + public static final Capability CAP_PASSIVE_PROVIDER = CapabilityManager.get(new CapabilityToken<>() + { + }); + + @SubscribeEvent + public static void registerCapability(RegisterCapabilitiesEvent event) + { + event.register(IMjConnector.class); + event.register(IMjReceiver.class); + event.register(IMjRedstoneReceiver.class); + event.register(IMjReadable.class); + event.register(IMjPassiveProvider.class); } - private static long getMjValue() { + // Calen 上面直接注册 +// static +// { +// CAP_CONNECTOR = CapabilitiesHelper.registerCapability(IMjConnector.class); +// CAP_RECEIVER = CapabilitiesHelper.registerCapability(IMjReceiver.class); +// CAP_REDSTONE_RECEIVER = CapabilitiesHelper.registerCapability(IMjRedstoneReceiver.class); +// CAP_READABLE = CapabilitiesHelper.registerCapability(IMjReadable.class); +// CAP_PASSIVE_PROVIDER = CapabilitiesHelper.registerCapability(IMjPassiveProvider.class); +// } +// +// public static void attachAbility(AttachCapabilitiesEvent event) +// { +// final BlockEntity be = event.getObject(); +//// if (be instanceof TileDistiller_BC8||be instanceof TilePump) +//// { +//// if (!be.getCapability(MjAPI.CAP_RECEIVER).isPresent()) +//// { +//// event.addCapability(MjAPI.CAP_RECEIVER_ID, new ICapabilityProvider() +//// { +//// @NotNull +//// @Override +//// public LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) +//// { +//// if (cap == MjAPI.CAP_RECEIVER) +//// { +//// return (LazyOptional)be.getCapability(MjAPI.CAP_RECEIVER); +////// return LazyOptional.of(() -> ((IFluidHandlerAdv)((TileBC_Neptune) be).getCapability())).cast(); +//// } +//// return LazyOptional.empty(); +//// } +//// }); +//// } +//// } +// } + + + private static long getMjValue() + { return 1_000_000L; } } diff --git a/api/buildcraft/api/mj/MjBattery.java b/api/buildcraft/api/mj/MjBattery.java index 68c2ea1..e05247a 100644 --- a/api/buildcraft/api/mj/MjBattery.java +++ b/api/buildcraft/api/mj/MjBattery.java @@ -1,17 +1,15 @@ package buildcraft.api.mj; import io.netty.buffer.ByteBuf; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.util.INBTSerializable; -/** Provides a basic implementation of a simple battery. Note that you should call {@link #tick(World, BlockPos)} or - * {@link #tick(World, Vec3d)} every tick to allow for losing excess power. */ -public class MjBattery implements INBTSerializable { +/** Provides a basic implementation of a simple battery. Note that you should call {@link #tick(Level, BlockPos)} or + * {@link #tick(Level, Vec3)} every tick to allow for losing excess power. */ +public class MjBattery implements INBTSerializable { private final long capacity; private long microJoules = 0; @@ -20,14 +18,14 @@ public MjBattery(long capacity) { } @Override - public NBTTagCompound serializeNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setLong("stored", microJoules); + public CompoundTag serializeNBT() { + CompoundTag nbt = new CompoundTag(); + nbt.putLong("stored", microJoules); return nbt; } @Override - public void deserializeNBT(NBTTagCompound nbt) { + public void deserializeNBT(CompoundTag nbt) { microJoules = nbt.getLong("stored"); } @@ -89,17 +87,17 @@ public long getCapacity() { return capacity; } - public void tick(World world, BlockPos position) { - tick(world, new Vec3d(position.getX() + 0.5, position.getY() + 0.5, position.getZ() + 0.5)); + public void tick(Level world, BlockPos position) { + tick(world, new Vec3(position.getX() + 0.5, position.getY() + 0.5, position.getZ() + 0.5)); } - public void tick(World world, Vec3d position) { + public void tick(Level world, Vec3 position) { if (microJoules > capacity * 2) { losePower(world, position); } } - protected void losePower(World world, Vec3d position) { + protected void losePower(Level world, Vec3 position) { long diff = microJoules - capacity * 2; long lost = ceilDivide(diff, 32); microJoules -= lost; diff --git a/api/buildcraft/api/mj/MjCapabilityHelper.java b/api/buildcraft/api/mj/MjCapabilityHelper.java index c70c74c..86c5eb1 100644 --- a/api/buildcraft/api/mj/MjCapabilityHelper.java +++ b/api/buildcraft/api/mj/MjCapabilityHelper.java @@ -1,15 +1,18 @@ package buildcraft.api.mj; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.util.EnumFacing; - +import net.minecraft.core.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.util.LazyOptional; -/** Provides a quick way to return all types of a single {@link IMjConnector} for all the different capabilities. */ -public class MjCapabilityHelper implements ICapabilityProvider { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Provides a quick way to return all types of a single {@link IMjConnector} for all the different capabilities. + */ +public class MjCapabilityHelper implements ICapabilityProvider +{ @Nonnull private final IMjConnector connector; @@ -26,7 +29,8 @@ public class MjCapabilityHelper implements ICapabilityProvider { @Nullable private final IMjPassiveProvider provider; - public MjCapabilityHelper(@Nonnull IMjConnector mj) { + public MjCapabilityHelper(@Nonnull IMjConnector mj) + { this.connector = mj; this.receiver = mj instanceof IMjReceiver ? (IMjReceiver) mj : null; this.rsReceiver = mj instanceof IMjRedstoneReceiver ? (IMjRedstoneReceiver) mj : null; @@ -34,28 +38,42 @@ public MjCapabilityHelper(@Nonnull IMjConnector mj) { this.provider = mj instanceof IMjPassiveProvider ? (IMjPassiveProvider) mj : null; } - @Override - public boolean hasCapability(@Nonnull Capability capability, EnumFacing facing) { - return getCapability(capability, facing) != null; - } + // Calen: getCapability(...).isPresent() + // @Override +// public boolean hasCapability(@Nonnull Capability capability, Direction facing) +// { +//// return getCapability(capability, facing) != null; +// return getCapability(capability, facing).isPresent(); +// } @Override - public T getCapability(@Nonnull Capability capability, EnumFacing facing) { - if (capability == MjAPI.CAP_CONNECTOR) { - return MjAPI.CAP_CONNECTOR.cast(connector); + public LazyOptional getCapability(@Nonnull Capability capability, Direction facing) + { + if (capability == MjAPI.CAP_CONNECTOR) + { +// return MjAPI.CAP_CONNECTOR.cast(connector); + return connector == null ? LazyOptional.empty() : LazyOptional.of(() -> connector).cast(); } - if (capability == MjAPI.CAP_RECEIVER) { - return MjAPI.CAP_RECEIVER.cast(receiver); + if (capability == MjAPI.CAP_RECEIVER) + { +// return MjAPI.CAP_RECEIVER.cast(receiver); + return receiver == null ? LazyOptional.empty() : LazyOptional.of(() -> receiver).cast(); } - if (capability == MjAPI.CAP_REDSTONE_RECEIVER) { - return MjAPI.CAP_REDSTONE_RECEIVER.cast(rsReceiver); + if (capability == MjAPI.CAP_REDSTONE_RECEIVER) + { +// return MjAPI.CAP_REDSTONE_RECEIVER.cast(rsReceiver); + return rsReceiver == null ? LazyOptional.empty() : LazyOptional.of(() -> rsReceiver).cast(); } - if (capability == MjAPI.CAP_READABLE) { - return MjAPI.CAP_READABLE.cast(readable); + if (capability == MjAPI.CAP_READABLE) + { +// return MjAPI.CAP_READABLE.cast(readable); + return readable == null ? LazyOptional.empty() : LazyOptional.of(() -> readable).cast(); } - if (capability == MjAPI.CAP_PASSIVE_PROVIDER) { - return MjAPI.CAP_PASSIVE_PROVIDER.cast(provider); + if (capability == MjAPI.CAP_PASSIVE_PROVIDER) + { +// return MjAPI.CAP_PASSIVE_PROVIDER.cast(provider); + return provider == null ? LazyOptional.empty() :LazyOptional.of(() -> provider).cast(); } - return null; + return LazyOptional.empty(); } } diff --git a/api/buildcraft/api/power/IEngine.java b/api/buildcraft/api/power/IEngine.java index c25037c..ff37f26 100644 --- a/api/buildcraft/api/power/IEngine.java +++ b/api/buildcraft/api/power/IEngine.java @@ -4,7 +4,7 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.power; -import net.minecraft.util.EnumFacing; +import net.minecraft.core.Direction; /** Engines should implement this interface if they want to support BuildCraft's behaviour of passing power between * engines without using receivePower() (which has other issues). */ @@ -13,7 +13,7 @@ public interface IEngine { * * @param side * @return */ - boolean canReceiveFromEngine(EnumFacing side); + boolean canReceiveFromEngine(Direction side); /** Receives power from an engine. * diff --git a/api/buildcraft/api/power/package-info.java b/api/buildcraft/api/power/package-info.java index 66e7868..9b10296 100644 --- a/api/buildcraft/api/power/package-info.java +++ b/api/buildcraft/api/power/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.3", owner = "buildcraftapi_core", provides = "buildcraftapi_power") +//@API(apiVersion = "1.3", owner = "buildcraftapi_core", provides = "buildcraftapi_power") package buildcraft.api.power; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/properties/BuildCraftProperties.java b/api/buildcraft/api/properties/BuildCraftProperties.java index a04b44e..cc72e06 100644 --- a/api/buildcraft/api/properties/BuildCraftProperties.java +++ b/api/buildcraft/api/properties/BuildCraftProperties.java @@ -1,85 +1,101 @@ package buildcraft.api.properties; -import java.util.Map; - +import buildcraft.api.enums.*; import com.google.common.collect.Maps; +import net.minecraft.core.Direction; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.block.state.properties.Property; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.enums.EnumDecoratedBlock; -import buildcraft.api.enums.EnumEngineType; -import buildcraft.api.enums.EnumLaserTableType; -import buildcraft.api.enums.EnumMachineState; -import buildcraft.api.enums.EnumOptionalSnapshotType; -import buildcraft.api.enums.EnumPowerStage; -import buildcraft.api.enums.EnumSpring; +import java.util.Map; -public final class BuildCraftProperties { - public static final IProperty BLOCK_FACING = PropertyEnum.create("facing", EnumFacing.class, EnumFacing.Plane.HORIZONTAL.facings()); - public static final IProperty BLOCK_FACING_6 = PropertyEnum.create("facing", EnumFacing.class); +public final class BuildCraftProperties +{ + public static final Property BLOCK_FACING = EnumProperty.create("facing", Direction.class, new Direction[]{Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST}); + public static final Property BLOCK_FACING_6 = EnumProperty.create("facing", Direction.class); - public static final IProperty BLOCK_COLOR = PropertyEnum.create("color", EnumDyeColor.class); - public static final IProperty SPRING_TYPE = PropertyEnum.create("type", EnumSpring.class); - public static final IProperty ENGINE_TYPE = PropertyEnum.create("type", EnumEngineType.class); - public static final IProperty LASER_TABLE_TYPE = PropertyEnum.create("type", EnumLaserTableType.class); - public static final IProperty MACHINE_STATE = PropertyEnum.create("state", EnumMachineState.class); - public static final IProperty ENERGY_STAGE = PropertyEnum.create("stage", EnumPowerStage.class); - public static final IProperty SNAPSHOT_TYPE = PropertyEnum.create("snapshot_type", EnumOptionalSnapshotType.class); - public static final IProperty DECORATED_BLOCK = PropertyEnum.create("decoration_type", EnumDecoratedBlock.class); + public static final Property BLOCK_COLOR = EnumProperty.create("color", DyeColor.class); +// public static final EnumProperty SPRING_TYPE = EnumProperty.create("type", EnumSpring.class); + public static final Property ENGINE_TYPE = EnumProperty.create("type", EnumEngineType.class); + public static final Property LASER_TABLE_TYPE = EnumProperty.create("type", EnumLaserTableType.class); + public static final Property MACHINE_STATE = EnumProperty.create("state", EnumMachineState.class); + public static final Property ENERGY_STAGE = EnumProperty.create("stage", EnumPowerStage.class); + public static final Property SNAPSHOT_TYPE = EnumProperty.create("snapshot_type", EnumOptionalSnapshotType.class); + public static final Property DECORATED_BLOCK = EnumProperty.create("decoration_type", EnumDecoratedBlock.class); - public static final IProperty GENERIC_PIPE_DATA = PropertyInteger.create("pipe_data", 0, 15); - public static final IProperty LED_POWER = PropertyInteger.create("led_power", 0, 3); + public static final Property GENERIC_PIPE_DATA = IntegerProperty.create("pipe_data", 0, 15); + public static final Property LED_POWER = IntegerProperty.create("led_power", 0, 3); +// // Calen: [/ 8] for pump oil [* 7 / 8] +// public static final Property SPRING_TOTAL_SOURCE = IntegerProperty.create("spring_total_source", 0, Integer.MAX_VALUE / 8); - public static final IProperty JOINED_BELOW = PropertyBool.create("joined_below"); - public static final IProperty MOVING = PropertyBool.create("moving"); - public static final IProperty LED_DONE = PropertyBool.create("led_done"); - public static final IProperty ACTIVE = PropertyBool.create("active"); - public static final IProperty VALID = PropertyBool.create("valid"); + public static final Property JOINED_BELOW = BooleanProperty.create("joined_below"); // 这里的注册名就是model文件里的条件 + public static final Property MOVING = BooleanProperty.create("moving"); + public static final Property LED_DONE = BooleanProperty.create("led_done"); + public static final Property ACTIVE = BooleanProperty.create("active"); + public static final Property VALID = BooleanProperty.create("valid"); - public static final IProperty CONNECTED_UP = PropertyBool.create("connected_up"); - public static final IProperty CONNECTED_DOWN = PropertyBool.create("connected_down"); - public static final IProperty CONNECTED_EAST = PropertyBool.create("connected_east"); - public static final IProperty CONNECTED_WEST = PropertyBool.create("connected_west"); - public static final IProperty CONNECTED_NORTH = PropertyBool.create("connected_north"); - public static final IProperty CONNECTED_SOUTH = PropertyBool.create("connected_south"); + public static final Property CONNECTED_UP = BooleanProperty.create("connected_up"); + public static final Property CONNECTED_DOWN = BooleanProperty.create("connected_down"); + public static final Property CONNECTED_EAST = BooleanProperty.create("connected_east"); + public static final Property CONNECTED_WEST = BooleanProperty.create("connected_west"); + public static final Property CONNECTED_NORTH = BooleanProperty.create("connected_north"); + public static final Property CONNECTED_SOUTH = BooleanProperty.create("connected_south"); - public static final Map> CONNECTED_MAP; + public static final Map> CONNECTED_MAP; - // Block state setting flags -these are used by World.markAndNotifyBlock and World.setBlockState. These flags can be + // Block state setting flags -these are used by Level.markAndNotifyBlock and Level.setBlockState. These flags can be // added together to pass the additions public static final int UPDATE_NONE = 0; - /** This updates the neighbouring blocks that the new block is set. It also updates the comparator output of this - * block. */ + /** + * This updates the neighbouring blocks that the new core is set. It also updates the comparator output of this + * core. + */ public static final int UPDATE_NEIGHBOURS = 1; - /** This will mark the block for an update next tick, as well as send an update to the client (if this is a server - * world). */ + /** + * This will mark the core for an update next tick, as well as send an update to the client (if this is a server + * world). + */ public static final int MARK_BLOCK_FOR_UPDATE = 2; - /** This will mark the block for an update, even if this is a client world. It is useless to use this if - * world.isRemote returns false. */ + /** + * This will mark the core for an update, even if this is a client world. It is useless to use this if + * world.isRemote returns false. + */ public static final int UPDATE_EVEN_CLIENT = 4 + MARK_BLOCK_FOR_UPDATE; // 6 - // Pre-added flags- pass these as-is to the World.markAndNotifyBlock and World.setBlockState methods. - /** This will do what both {@link #UPDATE_NEIGHBOURS} and {@link #MARK_BLOCK_FOR_UPDATE} do. */ + // Pre-added flags- pass these as-is to the Level.markAndNotifyBlock and Level.setBlockState methods. + /** + * This will do what both {@link #UPDATE_NEIGHBOURS} and {@link #MARK_BLOCK_FOR_UPDATE} do. + */ public static final int MARK_THIS_AND_NEIGHBOURS = UPDATE_NEIGHBOURS + MARK_BLOCK_FOR_UPDATE; - /** This will update everything about this block. */ + /** + * This will update everything about this core. + */ public static final int UPDATE_ALL = UPDATE_NEIGHBOURS + MARK_BLOCK_FOR_UPDATE + UPDATE_EVEN_CLIENT; - static { - Map> map = Maps.newEnumMap(EnumFacing.class); - map.put(EnumFacing.DOWN, CONNECTED_DOWN); - map.put(EnumFacing.UP, CONNECTED_UP); - map.put(EnumFacing.EAST, CONNECTED_EAST); - map.put(EnumFacing.WEST, CONNECTED_WEST); - map.put(EnumFacing.NORTH, CONNECTED_NORTH); - map.put(EnumFacing.SOUTH, CONNECTED_SOUTH); + static + { + Map> map = Maps.newEnumMap(Direction.class); + map.put(Direction.DOWN, CONNECTED_DOWN); + map.put(Direction.UP, CONNECTED_UP); + map.put(Direction.EAST, CONNECTED_EAST); + map.put(Direction.WEST, CONNECTED_WEST); + map.put(Direction.NORTH, CONNECTED_NORTH); + map.put(Direction.SOUTH, CONNECTED_SOUTH); CONNECTED_MAP = Maps.immutableEnumMap(map); } - /** Deactivate constructor */ - private BuildCraftProperties() {} +// // 初始化一下 否则spring block拿到的BuildCraftProperties.SPRING_TYPE是null? +// public static void init() +// { +// new BuildCraftProperties(); +// } + + /** + * Deactivate constructor + */ + private BuildCraftProperties() + { + } } diff --git a/api/buildcraft/api/recipes/AssemblyRecipe.java b/api/buildcraft/api/recipes/AssemblyRecipe.java index cbd8eb5..fe5094b 100644 --- a/api/buildcraft/api/recipes/AssemblyRecipe.java +++ b/api/buildcraft/api/recipes/AssemblyRecipe.java @@ -1,25 +1,37 @@ package buildcraft.api.recipes; -import java.util.Set; +import buildcraft.silicon.BCSilicon; +import buildcraft.silicon.recipe.AssemblyRecipeSerializer; +import net.minecraft.core.NonNullList; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; +import net.minecraftforge.registries.IForgeRegistryEntry; import javax.annotation.Nonnull; import javax.annotation.Nullable; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; - -import net.minecraftforge.registries.IForgeRegistryEntry; +import java.util.Set; /** * @deprecated TEMPORARY CLASS DO NOT USE! */ @Deprecated -public abstract class AssemblyRecipe implements Comparable, IForgeRegistryEntry { +//public abstract class AssemblyRecipe implements Comparable, IForgeRegistryEntry +public abstract class AssemblyRecipe implements Comparable, IForgeRegistryEntry, Recipe +{ + public static final ResourceLocation TYPE_ID = new ResourceLocation(BCSilicon.MOD_ID, "assembly"); + + public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); + private ResourceLocation name; /** * The outputs this recipe can generate with any of the given inputs + * * @param inputs Current ingredients in the assembly table * @return A Set containing all possible outputs given the given inputs or an empty one if nothing can be assembled from the given inputs */ @@ -32,22 +44,27 @@ public abstract class AssemblyRecipe implements Comparable, IFor /** * Used to determine what items to use up for the given output + * * @param output The output we want to know the inputs for, only ever called using stacks obtained from getOutputs or getOutputPreviews */ public abstract Set getInputsFor(@Nonnull ItemStack output); /** * Used to determine how much MJ is required to asemble the given output item + * * @param output The output we want to know the MJ cost for, only ever called using stacks obtained from getOutputs or getOutputPreviews */ public abstract long getRequiredMicroJoulesFor(@Nonnull ItemStack output); @Override - public boolean equals(Object o) { - if (this == o) { + public boolean equals(Object o) + { + if (this == o) + { return true; } - if (o == null || getClass() != o.getClass()) { + if (o == null || getClass() != o.getClass()) + { return false; } @@ -57,29 +74,76 @@ public boolean equals(Object o) { } @Override - public int hashCode() { + public int hashCode() + { return name.hashCode(); } @Override - public int compareTo(AssemblyRecipe o) { + public int compareTo(AssemblyRecipe o) + { return name.toString().compareTo(o.name.toString()); } @Override - public AssemblyRecipe setRegistryName(ResourceLocation name) { + public AssemblyRecipe setRegistryName(ResourceLocation name) + { this.name = name; return this; } @Nullable @Override - public ResourceLocation getRegistryName() { + public ResourceLocation getRegistryName() + { return name; } @Override - public Class getRegistryType() { + public Class getRegistryType() + { return AssemblyRecipe.class; } + // Calen: for serialize + public abstract long getRequiredMicroJoulesForSerialize(); + public abstract Set getRequiredIngredientStacksForSerialize(); + public abstract Set getOutputForSerialize(); + + // Calen: forced by Recipe + + @Override + public ResourceLocation getId() + { + return name; + } + + @Override + public boolean matches(Container inv, Level world) + { + return false; + } + + @Override + public boolean canCraftInDimensions(int width, int height) + { + return true; + } + + @Override + public boolean isSpecial() + { + return true; + } + + @Override + public RecipeSerializer getSerializer() + { + return AssemblyRecipeSerializer.INSTANCE; + } + + @Override + public RecipeType getType() + { + return TYPE; + } } diff --git a/api/buildcraft/api/recipes/AssemblyRecipeBasic.java b/api/buildcraft/api/recipes/AssemblyRecipeBasic.java index 094d3c9..61362f4 100644 --- a/api/buildcraft/api/recipes/AssemblyRecipeBasic.java +++ b/api/buildcraft/api/recipes/AssemblyRecipeBasic.java @@ -6,62 +6,110 @@ package buildcraft.api.recipes; -import java.util.Collections; -import java.util.Set; - -import javax.annotation.Nonnull; - +import buildcraft.api.core.BuildCraftAPI; import com.google.common.collect.ImmutableSet; +import net.minecraft.core.NonNullList; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; - -import buildcraft.api.core.BuildCraftAPI; +import javax.annotation.Nonnull; +import java.util.Collections; +import java.util.Set; /** * @deprecated TEMPORARY CLASS DO NOT USE! */ @Deprecated -public class AssemblyRecipeBasic extends AssemblyRecipe { +public class AssemblyRecipeBasic extends AssemblyRecipe +{ + private final long requiredMicroJoules; private final ImmutableSet requiredStacks; private final ImmutableSet output; - public AssemblyRecipeBasic(ResourceLocation name, long requiredMicroJoules, ImmutableSet requiredStacks, @Nonnull ItemStack output) { + public AssemblyRecipeBasic(ResourceLocation name, long requiredMicroJoules, ImmutableSet requiredStacks, @Nonnull ItemStack output) + { this.requiredMicroJoules = requiredMicroJoules; this.requiredStacks = ImmutableSet.copyOf(requiredStacks); this.output = ImmutableSet.of(output); setRegistryName(name); } - public AssemblyRecipeBasic(String name, long requiredMicroJoules, ImmutableSet requiredStacks, @Nonnull ItemStack output) { + public AssemblyRecipeBasic(String name, long requiredMicroJoules, ImmutableSet requiredStacks, @Nonnull ItemStack output) + { this(BuildCraftAPI.nameToResourceLocation(name), requiredMicroJoules, requiredStacks, output); } - public AssemblyRecipeBasic(String name, long requiredMicroJoules, Set requiredStacks, @Nonnull ItemStack output) { + public AssemblyRecipeBasic(String name, long requiredMicroJoules, Set requiredStacks, @Nonnull ItemStack output) + { this(name, requiredMicroJoules, ImmutableSet.copyOf(requiredStacks), output); } @Override - public Set getOutputs(NonNullList inputs) { - if (requiredStacks.stream().allMatch((definition) -> inputs.stream().anyMatch((stack) -> !stack.isEmpty() && definition.ingredient.apply(stack) && stack.getCount() >= definition.count))) + public Set getOutputs(NonNullList inputs) + { + if ( + requiredStacks.stream().allMatch( + (definition) -> + inputs.stream().anyMatch( + (stack) -> +// !stack.isEmpty() && definition.ingredient.apply(stack) && stack.getCount() >= definition.count + !stack.isEmpty() && definition.ingredient.test(stack) && stack.getCount() >= definition.count + ) + ) + ) return output; return Collections.emptySet(); } @Override - public Set getOutputPreviews() { + public Set getOutputPreviews() + { return output; } @Override - public Set getInputsFor(@Nonnull ItemStack output) { + public Set getInputsFor(@Nonnull ItemStack output) + { return requiredStacks; } @Override - public long getRequiredMicroJoulesFor(@Nonnull ItemStack output) { + public long getRequiredMicroJoulesFor(@Nonnull ItemStack output) + { return requiredMicroJoules; } + + // Calen + + @Override + public long getRequiredMicroJoulesForSerialize() + { + return requiredMicroJoules; + } + + @Override + public Set getOutputForSerialize() + { + return output; + } + + @Override + public Set getRequiredIngredientStacksForSerialize() + { + return requiredStacks; + } + + @Override + public ItemStack getResultItem() + { + return output.asList().get(0); + } + + @Override + public ItemStack assemble(Container inv) + { + return output.asList().get(0); + } } diff --git a/api/buildcraft/api/recipes/AssemblyRecipeType.java b/api/buildcraft/api/recipes/AssemblyRecipeType.java new file mode 100644 index 0000000..2cdeaff --- /dev/null +++ b/api/buildcraft/api/recipes/AssemblyRecipeType.java @@ -0,0 +1,8 @@ +package buildcraft.api.recipes; + +// Calen +public enum AssemblyRecipeType +{ + BASIC, + FACADE, +} diff --git a/api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java b/api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java index 22ee171..ea4e570 100644 --- a/api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java +++ b/api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java @@ -4,7 +4,8 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.recipes; -public final class BuildcraftRecipeRegistry { +public final class BuildcraftRecipeRegistry +{ public static IIntegrationRecipeRegistry integrationRecipes; public static IRefineryRecipeManager refineryRecipes; diff --git a/api/buildcraft/api/recipes/IIntegrationRecipeProvider.java b/api/buildcraft/api/recipes/IIntegrationRecipeProvider.java index a6ebeaa..8518af5 100644 --- a/api/buildcraft/api/recipes/IIntegrationRecipeProvider.java +++ b/api/buildcraft/api/recipes/IIntegrationRecipeProvider.java @@ -1,12 +1,12 @@ package buildcraft.api.recipes; +import net.minecraft.core.NonNullList; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; - /** Provides a way of registering complex recipes without needing to register every possible variant. If you want the * recipes to be viewable in JEI and the guide book then you will *also* need to implement the bc lib class * IIntegrationRecipeViewable. */ diff --git a/api/buildcraft/api/recipes/IRefineryRecipeManager.java b/api/buildcraft/api/recipes/IRefineryRecipeManager.java index 65b523b..f9065ae 100644 --- a/api/buildcraft/api/recipes/IRefineryRecipeManager.java +++ b/api/buildcraft/api/recipes/IRefineryRecipeManager.java @@ -1,30 +1,48 @@ package buildcraft.api.recipes; +import buildcraft.api.BCModules; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.Container; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; +import net.minecraftforge.fluids.FluidStack; + +import javax.annotation.Nullable; import java.util.Collection; import java.util.function.Predicate; import java.util.stream.Stream; -import javax.annotation.Nullable; - -import net.minecraftforge.fluids.FluidStack; - -public interface IRefineryRecipeManager { - IHeatableRecipe createHeatingRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo); +public interface IRefineryRecipeManager +{ + // IHeatableRecipe createHeatingRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo); + IHeatableRecipe createHeatingRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo); - default IHeatableRecipe addHeatableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo) { - return getHeatableRegistry().addRecipe(createHeatingRecipe(in, out, heatFrom, heatTo)); + // default IHeatableRecipe addHeatableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo) + default IHeatableRecipe addUnregisteredHeatableRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo) + { +// return getHeatableRegistry().addRecipe(createHeatingRecipe(in, out, heatFrom, heatTo)); + return getHeatableRegistry().addUnregisteredRecipe(createHeatingRecipe(id, in, out, heatFrom, heatTo)); } - ICoolableRecipe createCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo); + // ICoolableRecipe createCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo); + ICoolableRecipe createCoolableRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo); - default ICoolableRecipe addCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo) { - return getCoolableRegistry().addRecipe(createCoolableRecipe(in, out, heatFrom, heatTo)); + // default ICoolableRecipe addCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo) + default ICoolableRecipe addUnregisteredCoolableRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo) + { +// return getCoolableRegistry().addRecipe(createCoolableRecipe(in, out, heatFrom, heatTo)); + return getCoolableRegistry().addUnregisteredRecipe(createCoolableRecipe(id, in, out, heatFrom, heatTo)); } - IDistillationRecipe createDistillationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired); + // IDistillationRecipe createDistillationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired); + IDistillationRecipe createDistillationRecipe(ResourceLocation id, FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired); - default IDistillationRecipe addDistillationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired) { - return getDistillationRegistry().addRecipe(createDistillationRecipe(in, outGas, outLiquid, powerRequired)); + // default IDistillationRecipe addDistillationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired) + default IDistillationRecipe addUnregisteredDistillationRecipe(ResourceLocation id, FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired) + { +// return getDistillationRegistry().addRecipe(createDistillationRecipe(in, outGas, outLiquid, powerRequired)); + return getDistillationRegistry().addUnregisteredRecipe(createDistillationRecipe(id, in, outGas, outLiquid, powerRequired)); } IRefineryRegistry getHeatableRegistry(); @@ -33,32 +51,50 @@ default IDistillationRecipe addDistillationRecipe(FluidStack in, FluidStack outG IRefineryRegistry getDistillationRegistry(); - interface IRefineryRegistry { - /** @return an unmodifiable collection containing all of the distillation recipes that satisfy the given - * predicate. All of the recipe objects are guaranteed to never be null. */ - Stream getRecipes(Predicate toReturn); - - /** @return an unmodifiable set containing all of the distillation recipes. */ - Collection getAllRecipes(); + interface IRefineryRegistry + { + /** + * @return an unmodifiable collection containing all of the distillation recipes that satisfy the given + * predicate. All of the recipe objects are guaranteed to never be null. + */ +// Stream getRecipes(Predicate toReturn); + Stream getRecipes(Level world, Predicate toReturn); + + /** + * @return an unmodifiable set containing all of the distillation recipes. + */ +// Collection getAllRecipes(); + Collection getAllRecipes(Level world); @Nullable - R getRecipeForInput(@Nullable FluidStack fluid); +// R getRecipeForInput(@Nullable FluidStack fluid); + R getRecipeForInput(Level world, @Nullable FluidStack fluid); - Collection removeRecipes(Predicate toRemove); + // Collection removeRecipes(Predicate toRemove); + Collection removeUnregisteredRecipes(Predicate toRemove); - /** Adds the given recipe to the registry. Note that this will remove any existing recipes for the passed + /** + * Adds the given recipe to the registry. Note that this will remove any existing recipes for the passed * recipe's {@link IRefineryRecipe#in()} - * + * * @param recipe The recipe to add. - * @return The input recipe. */ - R addRecipe(R recipe); + * @return The input recipe. + */ +// R addRecipe(R recipe); + R addUnregisteredRecipe(R recipe); + +// // Calen +// RecipeType getRecipeType; } - interface IRefineryRecipe { + // interface IRefineryRecipe + interface IRefineryRecipe extends Recipe + { FluidStack in(); } - interface IHeatExchangerRecipe extends IRefineryRecipe { + interface IHeatExchangerRecipe extends IRefineryRecipe + { @Nullable FluidStack out(); @@ -67,15 +103,49 @@ interface IHeatExchangerRecipe extends IRefineryRecipe { int heatTo(); } - interface IHeatableRecipe extends IHeatExchangerRecipe {} + interface IHeatableRecipe extends IHeatExchangerRecipe + { + public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.FACTORY.getModId(), "heat_exchange/heatable"); + + public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); - interface ICoolableRecipe extends IHeatExchangerRecipe {} - interface IDistillationRecipe extends IRefineryRecipe { + @Override + default RecipeType getType() + { + return TYPE; + } + } + + interface ICoolableRecipe extends IHeatExchangerRecipe + { + public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.FACTORY.getModId(), "heat_exchange/coolable"); + + public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); + + @Override + default RecipeType getType() + { + return TYPE; + } + } + + interface IDistillationRecipe extends IRefineryRecipe + { + public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.FACTORY.getModId(), "distillation"); + + public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); + long powerRequired(); FluidStack outGas(); FluidStack outLiquid(); + + @Override + default RecipeType getType() + { + return TYPE; + } } } diff --git a/api/buildcraft/api/recipes/IngredientStack.java b/api/buildcraft/api/recipes/IngredientStack.java index adbcdea..2001cf1 100644 --- a/api/buildcraft/api/recipes/IngredientStack.java +++ b/api/buildcraft/api/recipes/IngredientStack.java @@ -6,24 +6,62 @@ package buildcraft.api.recipes; -import net.minecraft.item.crafting.Ingredient; - +import com.google.gson.JsonElement; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; import net.minecraftforge.common.crafting.CraftingHelper; -public final class IngredientStack { +public final class IngredientStack +{ public final Ingredient ingredient; public final int count; - public IngredientStack(Ingredient ingredient, int count) { + public IngredientStack(Ingredient ingredient, int count) + { this.ingredient = ingredient; this.count = count; } - public IngredientStack(Ingredient ingredient) { + public IngredientStack(Ingredient ingredient) + { this(ingredient, 1); } - public static IngredientStack of(Object o) { +// public static IngredientStack of(Object o) + public static IngredientStack of(JsonElement o) + { return new IngredientStack(CraftingHelper.getIngredient(o)); } + + public static IngredientStack of(ItemStack o) + { + return new IngredientStack(Ingredient.of(o)); + } + + public static IngredientStack of(ItemLike o) + { + return new IngredientStack(Ingredient.of(o)); + } + + public static IngredientStack of(TagKey tag) + { + return new IngredientStack(Ingredient.of(tag)); + } + + // Calen + public void toNetwork(FriendlyByteBuf buffer) + { + buffer.writeInt(this.count); + this.ingredient.toNetwork(buffer); + } + + public static IngredientStack fromNetwork(FriendlyByteBuf buffer) + { + int countIn = buffer.readInt(); + Ingredient ingredientIn = Ingredient.fromNetwork(buffer); + return new IngredientStack(ingredientIn, countIn); + } } diff --git a/api/buildcraft/api/recipes/IntegrationRecipe.java b/api/buildcraft/api/recipes/IntegrationRecipe.java index 984404b..7dcc001 100644 --- a/api/buildcraft/api/recipes/IntegrationRecipe.java +++ b/api/buildcraft/api/recipes/IntegrationRecipe.java @@ -1,12 +1,11 @@ package buildcraft.api.recipes; -import javax.annotation.Nonnull; - import com.google.common.collect.ImmutableList; +import net.minecraft.core.NonNullList; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; +import javax.annotation.Nonnull; public abstract class IntegrationRecipe { public final ResourceLocation name; diff --git a/api/buildcraft/api/recipes/StackDefinition.java b/api/buildcraft/api/recipes/StackDefinition.java index b2d5f8a..e171d58 100644 --- a/api/buildcraft/api/recipes/StackDefinition.java +++ b/api/buildcraft/api/recipes/StackDefinition.java @@ -1,12 +1,14 @@ package buildcraft.api.recipes; + import buildcraft.api.core.IStackFilter; /** * @deprecated TEMPORARY CLASS DO NOT USE! */ @Deprecated -public final class StackDefinition { +public final class StackDefinition +{ public final IStackFilter filter; public final int count; diff --git a/api/buildcraft/api/recipes/package-info.java b/api/buildcraft/api/recipes/package-info.java index 596d90d..328eb32 100644 --- a/api/buildcraft/api/recipes/package-info.java +++ b/api/buildcraft/api/recipes/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "3.0", owner = "buildcraftapi_core", provides = "buildcraftapi_recipes") +//@API(apiVersion = "3.0", owner = "buildcraftapi_core", provides = "buildcraftapi_recipes") package buildcraft.api.recipes; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/registry/BuildCraftRegistryManager.java b/api/buildcraft/api/registry/BuildCraftRegistryManager.java index 4dd23f5..31af0df 100644 --- a/api/buildcraft/api/registry/BuildCraftRegistryManager.java +++ b/api/buildcraft/api/registry/BuildCraftRegistryManager.java @@ -1,6 +1,7 @@ package buildcraft.api.registry; -public class BuildCraftRegistryManager { +public class BuildCraftRegistryManager +{ public static IReloadableRegistryManager managerDataPacks; /** Null on the dedicated server. */ diff --git a/api/buildcraft/api/registry/EventBuildCraftReload.java b/api/buildcraft/api/registry/EventBuildCraftReload.java index 903a9c3..e07a039 100644 --- a/api/buildcraft/api/registry/EventBuildCraftReload.java +++ b/api/buildcraft/api/registry/EventBuildCraftReload.java @@ -1,18 +1,16 @@ package buildcraft.api.registry; -import java.util.Set; - -import javax.annotation.Nullable; - import com.google.gson.GsonBuilder; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; - +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.common.eventhandler.Event; -public abstract class EventBuildCraftReload extends Event { +import javax.annotation.Nullable; +import java.util.Set; + +public abstract class EventBuildCraftReload extends Event +{ /** The manager that is being reloaded. */ public final IReloadableRegistryManager manager; diff --git a/api/buildcraft/api/registry/IReloadableRegistry.java b/api/buildcraft/api/registry/IReloadableRegistry.java index e973dad..61e0b1a 100644 --- a/api/buildcraft/api/registry/IReloadableRegistry.java +++ b/api/buildcraft/api/registry/IReloadableRegistry.java @@ -1,10 +1,10 @@ package buildcraft.api.registry; +import net.minecraft.resources.ResourceLocation; + import java.util.Collection; import java.util.Map; -import net.minecraft.util.ResourceLocation; - /** A registry of any Java object. This does not perform serialisation of any kind to the entries. */ public interface IReloadableRegistry { diff --git a/api/buildcraft/api/registry/IReloadableRegistryManager.java b/api/buildcraft/api/registry/IReloadableRegistryManager.java index 9c71ba1..d62ac5e 100644 --- a/api/buildcraft/api/registry/IReloadableRegistryManager.java +++ b/api/buildcraft/api/registry/IReloadableRegistryManager.java @@ -1,11 +1,12 @@ package buildcraft.api.registry; +import buildcraft.api.registry.IReloadableRegistry.PackType; + import java.util.Map; import java.util.Set; -import buildcraft.api.registry.IReloadableRegistry.PackType; - -public interface IReloadableRegistryManager { +public interface IReloadableRegistryManager +{ PackType getType(); diff --git a/api/buildcraft/api/registry/IScriptableRegistry.java b/api/buildcraft/api/registry/IScriptableRegistry.java index b6bae4d..dd39be8 100644 --- a/api/buildcraft/api/registry/IScriptableRegistry.java +++ b/api/buildcraft/api/registry/IScriptableRegistry.java @@ -1,16 +1,14 @@ package buildcraft.api.registry; -import java.util.Map; -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; +import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.ResourceLocation; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.Map; +import java.util.Set; /** A type of {@link IReloadableRegistry} that can be configured with buildcraft style simple scripts. A full * description can be found [...] */ diff --git a/api/buildcraft/api/robots/AIRobot.java b/api/buildcraft/api/robots/AIRobot.java index 0fad582..5acf192 100755 --- a/api/buildcraft/api/robots/AIRobot.java +++ b/api/buildcraft/api/robots/AIRobot.java @@ -4,10 +4,9 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.robots; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - import buildcraft.api.mj.MjAPI; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.ItemStack; public class AIRobot { public EntityRobotBase robot; @@ -55,11 +54,11 @@ public void delegateAIAborted(AIRobot ai) { } - public void writeSelfToNBT(NBTTagCompound nbt) { + public void writeSelfToNBT(CompoundTag nbt) { } - public void loadSelfFromNBT(NBTTagCompound nbt) { + public void loadSelfFromNBT(CompoundTag nbt) { } @@ -155,30 +154,30 @@ public final AIRobot getDelegateAI() { return delegateAI; } - public final void writeToNBT(NBTTagCompound nbt) { - nbt.setString("aiName", RobotManager.getAIRobotName(getClass())); + public final void writeToNBT(CompoundTag nbt) { + nbt.putString("aiName", RobotManager.getAIRobotName(getClass())); - NBTTagCompound data = new NBTTagCompound(); + CompoundTag data = new CompoundTag(); writeSelfToNBT(data); - nbt.setTag("data", data); + nbt.put("data", data); if (delegateAI != null && delegateAI.canLoadFromNBT()) { - NBTTagCompound sub = new NBTTagCompound(); + CompoundTag sub = new CompoundTag(); delegateAI.writeToNBT(sub); - nbt.setTag("delegateAI", sub); + nbt.put("delegateAI", sub); } } - public final void loadFromNBT(NBTTagCompound nbt) { - loadSelfFromNBT(nbt.getCompoundTag("data")); + public final void loadFromNBT(CompoundTag nbt) { + loadSelfFromNBT(nbt.getCompound("data")); - if (nbt.hasKey("delegateAI")) { - NBTTagCompound sub = nbt.getCompoundTag("delegateAI"); + if (nbt.contains("delegateAI")) { + CompoundTag sub = nbt.getCompound("delegateAI"); try { Class aiRobotClass; - if (sub.hasKey("class")) { + if (sub.contains("class")) { // Migration support for 6.4.x aiRobotClass = RobotManager.getAIRobotByLegacyClassName(sub.getString("class")); } else { @@ -198,12 +197,12 @@ public final void loadFromNBT(NBTTagCompound nbt) { } } - public static AIRobot loadAI(NBTTagCompound nbt, EntityRobotBase robot) { + public static AIRobot loadAI(CompoundTag nbt, EntityRobotBase robot) { AIRobot ai = null; try { Class aiRobotClass; - if (nbt.hasKey("class")) { + if (nbt.contains("class")) { // Migration support for 6.4.x aiRobotClass = RobotManager.getAIRobotByLegacyClassName(nbt.getString("class")); } else { diff --git a/api/buildcraft/api/robots/DockingStation.java b/api/buildcraft/api/robots/DockingStation.java index d3237a0..2a315a8 100755 --- a/api/buildcraft/api/robots/DockingStation.java +++ b/api/buildcraft/api/robots/DockingStation.java @@ -4,24 +4,22 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.robots; -import java.util.Arrays; - -import net.minecraft.inventory.IInventory; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.fluids.capability.IFluidHandler; - import buildcraft.api.core.BCLog; import buildcraft.api.core.EnumPipePart; import buildcraft.api.statements.StatementSlot; import buildcraft.api.transport.IInjectable; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.Container; +import net.minecraft.world.level.Level; +import net.minecraftforge.fluids.capability.IFluidHandler; + +import java.util.Arrays; public abstract class DockingStation { - public EnumFacing side; - public World world; + public Direction side; + public Level world; private long robotTakingId = EntityRobotBase.NULL_ROBOT_ID; private EntityRobotBase robotTaking; @@ -30,7 +28,7 @@ public abstract class DockingStation { private BlockPos pos; - public DockingStation(BlockPos iIndex, EnumFacing iSide) { + public DockingStation(BlockPos iIndex, Direction iSide) { pos = iIndex; side = iSide; } @@ -45,7 +43,7 @@ public BlockPos getPos() { return pos; } - public EnumFacing side() { + public Direction side() { return side; } @@ -116,20 +114,20 @@ public void unsafeRelease(EntityRobotBase robot) { } } - public void writeToNBT(NBTTagCompound nbt) { - nbt.setIntArray("pos", new int[] { getPos().getX(), getPos().getY(), getPos().getZ() }); - nbt.setByte("side", (byte) side.ordinal()); - nbt.setBoolean("isMain", linkIsMain); - nbt.setLong("robotId", robotTakingId); + public void writeToNBT(CompoundTag nbt) { + nbt.putIntArray("pos", new int[] { getPos().getX(), getPos().getY(), getPos().getZ() }); + nbt.putByte("side", (byte) side.ordinal()); + nbt.putBoolean("isMain", linkIsMain); + nbt.putLong("robotId", robotTakingId); } - public void readFromNBT(NBTTagCompound nbt) { - if (nbt.hasKey("index")) { + public void readFromNBT(CompoundTag nbt) { + if (nbt.contains("index")) { // For compatibility with older versions of minecraft and buildcraft - NBTTagCompound indexNBT = nbt.getCompoundTag("index"); - int x = indexNBT.getInteger("i"); - int y = indexNBT.getInteger("j"); - int z = indexNBT.getInteger("k"); + CompoundTag indexNBT = nbt.getCompound("index"); + int x = indexNBT.getInt("i"); + int y = indexNBT.getInt("j"); + int z = indexNBT.getInt("k"); pos = new BlockPos(x, y, z); } else { int[] array = nbt.getIntArray("pos"); @@ -141,7 +139,7 @@ public void readFromNBT(NBTTagCompound nbt) { BCLog.logger.warn("Did not find any integer positions! This is a bug!"); } } - side = EnumFacing.values()[nbt.getByte("side")]; + side = Direction.values()[nbt.getByte("side")]; linkIsMain = nbt.getBoolean("isMain"); robotTakingId = nbt.getLong("robotId"); } @@ -189,7 +187,7 @@ public EnumPipePart getItemOutputSide() { return EnumPipePart.CENTER; } - public IInventory getItemInput() { + public Container getItemInput() { return null; } diff --git a/api/buildcraft/api/robots/EntityRobotBase.java b/api/buildcraft/api/robots/EntityRobotBase.java index 0e6439d..599369b 100755 --- a/api/buildcraft/api/robots/EntityRobotBase.java +++ b/api/buildcraft/api/robots/EntityRobotBase.java @@ -4,30 +4,30 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.robots; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.items.IItemHandler; - import buildcraft.api.boards.RedstoneBoardRobot; import buildcraft.api.core.IFluidHandlerAdv; import buildcraft.api.core.IZone; import buildcraft.api.mj.MjAPI; import buildcraft.api.mj.MjBattery; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.items.IItemHandler; -public abstract class EntityRobotBase extends EntityLiving implements IItemHandler, IFluidHandlerAdv { +public abstract class EntityRobotBase extends LivingEntity implements IItemHandler, IFluidHandlerAdv { public static final long MAX_POWER = 5000 * MjAPI.MJ; public static final long SAFETY_POWER = MAX_POWER / 5; public static final long SHUTDOWN_POWER = 0; public static final long NULL_ROBOT_ID = Long.MAX_VALUE; - public EntityRobotBase(World par1World) { - super(par1World); + public EntityRobotBase(Level par1World) { + // TODO Calen robot entity type? +// super(par1World); + super(null,par1World); } public abstract void setItemInUse(ItemStack stack); @@ -80,7 +80,7 @@ public long getPower() { public abstract void onChunkUnload(); - public abstract ItemStack receiveItem(TileEntity tile, ItemStack stack); + public abstract ItemStack receiveItem(BlockEntity tile, ItemStack stack); public abstract void setMainStation(DockingStation station); } diff --git a/api/buildcraft/api/robots/IRequestProvider.java b/api/buildcraft/api/robots/IRequestProvider.java index 2e56148..22dbcb8 100755 --- a/api/buildcraft/api/robots/IRequestProvider.java +++ b/api/buildcraft/api/robots/IRequestProvider.java @@ -4,7 +4,7 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.robots; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; /** Provide requests of items that need to be fulfilled. * diff --git a/api/buildcraft/api/robots/IRobotOverlayItem.java b/api/buildcraft/api/robots/IRobotOverlayItem.java index fa39ee1..6562302 100644 --- a/api/buildcraft/api/robots/IRobotOverlayItem.java +++ b/api/buildcraft/api/robots/IRobotOverlayItem.java @@ -1,14 +1,13 @@ package buildcraft.api.robots; import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public interface IRobotOverlayItem { boolean isValidRobotOverlay(ItemStack stack); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) void renderRobotOverlay(ItemStack stack, TextureManager textureManager); } diff --git a/api/buildcraft/api/robots/IRobotRegistry.java b/api/buildcraft/api/robots/IRobotRegistry.java index 96360f5..e313b5b 100755 --- a/api/buildcraft/api/robots/IRobotRegistry.java +++ b/api/buildcraft/api/robots/IRobotRegistry.java @@ -4,11 +4,11 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.robots; -import java.util.Collection; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; +import java.util.Collection; public interface IRobotRegistry { @@ -36,7 +36,7 @@ public interface IRobotRegistry { void releaseResources(EntityRobotBase robot); - DockingStation getStation(BlockPos pos, EnumFacing side); + DockingStation getStation(BlockPos pos, Direction side); Collection getStations(); @@ -48,9 +48,9 @@ public interface IRobotRegistry { void release(DockingStation station, long robotId); - void writeToNBT(NBTTagCompound nbt); + void writeToNBT(CompoundTag nbt); - void readFromNBT(NBTTagCompound nbt); + void readFromNBT(CompoundTag nbt); void registryMarkDirty(); } diff --git a/api/buildcraft/api/robots/IRobotRegistryProvider.java b/api/buildcraft/api/robots/IRobotRegistryProvider.java index 0012494..e3eef09 100644 --- a/api/buildcraft/api/robots/IRobotRegistryProvider.java +++ b/api/buildcraft/api/robots/IRobotRegistryProvider.java @@ -1,7 +1,7 @@ package buildcraft.api.robots; -import net.minecraft.world.World; +import net.minecraft.world.level.Level; public interface IRobotRegistryProvider { - IRobotRegistry getRegistry(World world); + IRobotRegistry getRegistry(Level world); } diff --git a/api/buildcraft/api/robots/ResourceId.java b/api/buildcraft/api/robots/ResourceId.java index 539503a..8660725 100755 --- a/api/buildcraft/api/robots/ResourceId.java +++ b/api/buildcraft/api/robots/ResourceId.java @@ -4,22 +4,22 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.robots; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundTag; public abstract class ResourceId { protected ResourceId() {} - public void writeToNBT(NBTTagCompound nbt) { - nbt.setString("resourceName", RobotManager.getResourceIdName(getClass())); + public void writeToNBT(CompoundTag nbt) { + nbt.putString("resourceName", RobotManager.getResourceIdName(getClass())); } - protected void readFromNBT(NBTTagCompound nbt) {} + protected void readFromNBT(CompoundTag nbt) {} - public static ResourceId load(NBTTagCompound nbt) { + public static ResourceId load(CompoundTag nbt) { try { Class cls; - if (nbt.hasKey("class")) { + if (nbt.contains("class")) { // Migration support for 6.4.x cls = RobotManager.getResourceIdByLegacyClassName(nbt.getString("class")); } else { diff --git a/api/buildcraft/api/robots/ResourceIdBlock.java b/api/buildcraft/api/robots/ResourceIdBlock.java index 4e89a58..ad235db 100755 --- a/api/buildcraft/api/robots/ResourceIdBlock.java +++ b/api/buildcraft/api/robots/ResourceIdBlock.java @@ -4,13 +4,11 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.robots; -import org.apache.commons.lang3.builder.HashCodeBuilder; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; - import buildcraft.api.core.EnumPipePart; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.entity.BlockEntity; +import org.apache.commons.lang3.builder.HashCodeBuilder; public class ResourceIdBlock extends ResourceId { @@ -29,8 +27,8 @@ public ResourceIdBlock(BlockPos iIndex) { pos = iIndex; } - public ResourceIdBlock(TileEntity tile) { - pos = tile.getPos(); + public ResourceIdBlock(BlockEntity tile) { + pos = tile.getBlockPos(); } @Override @@ -51,21 +49,21 @@ public int hashCode() { } @Override - public void writeToNBT(NBTTagCompound nbt) { + public void writeToNBT(CompoundTag nbt) { super.writeToNBT(nbt); int[] arr = new int[] { pos.getX(), pos.getY(), pos.getZ() }; - nbt.setIntArray("pos", arr); + nbt.putIntArray("pos", arr); - nbt.setTag("side", side.writeToNBT()); + nbt.put("side", side.writeToNBT()); } @Override - protected void readFromNBT(NBTTagCompound nbt) { + protected void readFromNBT(CompoundTag nbt) { super.readFromNBT(nbt); int[] arr = nbt.getIntArray("pos"); pos = new BlockPos(arr[0], arr[1], arr[2]); - side = EnumPipePart.readFromNBT(nbt.getTag("side")); + side = EnumPipePart.readFromNBT(nbt.get("side")); } } diff --git a/api/buildcraft/api/robots/ResourceIdRequest.java b/api/buildcraft/api/robots/ResourceIdRequest.java index d224b8e..405728b 100755 --- a/api/buildcraft/api/robots/ResourceIdRequest.java +++ b/api/buildcraft/api/robots/ResourceIdRequest.java @@ -4,11 +4,9 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.robots; -import org.apache.commons.lang3.builder.HashCodeBuilder; - -import net.minecraft.nbt.NBTTagCompound; - import buildcraft.api.core.EnumPipePart; +import net.minecraft.nbt.CompoundTag; +import org.apache.commons.lang3.builder.HashCodeBuilder; public class ResourceIdRequest extends ResourceIdBlock { @@ -39,16 +37,16 @@ public int hashCode() { } @Override - public void writeToNBT(NBTTagCompound nbt) { + public void writeToNBT(CompoundTag nbt) { super.writeToNBT(nbt); - nbt.setInteger("localId", slot); + nbt.putInt("localId", slot); } @Override - protected void readFromNBT(NBTTagCompound nbt) { + protected void readFromNBT(CompoundTag nbt) { super.readFromNBT(nbt); - slot = nbt.getInteger("localId"); + slot = nbt.getInt("localId"); } } diff --git a/api/buildcraft/api/robots/RobotManager.java b/api/buildcraft/api/robots/RobotManager.java index 7c712c9..98dd22b 100644 --- a/api/buildcraft/api/robots/RobotManager.java +++ b/api/buildcraft/api/robots/RobotManager.java @@ -4,12 +4,12 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.robots; +import buildcraft.api.core.BCLog; + import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import buildcraft.api.core.BCLog; - public abstract class RobotManager { public static IRobotRegistryProvider registryProvider; public static ArrayList> aiRobots = new ArrayList<>(); diff --git a/api/buildcraft/api/robots/package-info.java b/api/buildcraft/api/robots/package-info.java index 6196069..fef8a54 100644 --- a/api/buildcraft/api/robots/package-info.java +++ b/api/buildcraft/api/robots/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "3.0", owner = "buildcraftapi_core", provides = "buildcraftapi_robotics") +//@API(apiVersion = "3.0", owner = "buildcraftapi_core", provides = "buildcraftapi_robotics") package buildcraft.api.robots; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/schematics/ISchematicBlock.java b/api/buildcraft/api/schematics/ISchematicBlock.java index 3ae62ed..d3adcea 100644 --- a/api/buildcraft/api/schematics/ISchematicBlock.java +++ b/api/buildcraft/api/schematics/ISchematicBlock.java @@ -1,22 +1,21 @@ package buildcraft.api.schematics; +import buildcraft.api.core.InvalidInputDataException; +import buildcraft.builders.snapshot.FakeWorld; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Rotation; +import net.minecraftforge.fluids.FluidStack; + +import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; import java.util.Set; -import javax.annotation.Nonnull; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Rotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.fluids.FluidStack; - -import buildcraft.api.core.InvalidInputDataException; - -public interface ISchematicBlock { +public interface ISchematicBlock +{ void init(SchematicBlockContext context); default boolean isAir() { @@ -40,20 +39,21 @@ default List computeRequiredFluids() { ISchematicBlock getRotated(Rotation rotation); - boolean canBuild(World world, BlockPos blockPos); + boolean canBuild(Level world, BlockPos blockPos); - default boolean isReadyToBuild(World world, BlockPos blockPos) { + default boolean isReadyToBuild(Level world, BlockPos blockPos) { return true; } - boolean build(World world, BlockPos blockPos); + boolean build(Level world, BlockPos blockPos); - boolean buildWithoutChecks(World world, BlockPos blockPos); +// boolean buildWithoutChecks(Level world, BlockPos blockPos); + boolean buildWithoutChecks(FakeWorld world, BlockPos blockPos); - boolean isBuilt(World world, BlockPos blockPos); + boolean isBuilt(Level world, BlockPos blockPos); - NBTTagCompound serializeNBT(); + CompoundTag serializeNBT(); /** @throws InvalidInputDataException If the input data wasn't correct or didn't make sense. */ - void deserializeNBT(NBTTagCompound nbt) throws InvalidInputDataException; + void deserializeNBT(CompoundTag nbt) throws InvalidInputDataException; } diff --git a/api/buildcraft/api/schematics/ISchematicEntity.java b/api/buildcraft/api/schematics/ISchematicEntity.java index b026f3b..39db485 100644 --- a/api/buildcraft/api/schematics/ISchematicEntity.java +++ b/api/buildcraft/api/schematics/ISchematicEntity.java @@ -1,26 +1,24 @@ package buildcraft.api.schematics; -import java.util.Collections; -import java.util.List; - -import javax.annotation.Nonnull; - -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Rotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - +import buildcraft.api.core.InvalidInputDataException; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.fluids.FluidStack; -import buildcraft.api.core.InvalidInputDataException; +import javax.annotation.Nonnull; +import java.util.Collections; +import java.util.List; -public interface ISchematicEntity { +public interface ISchematicEntity +{ void init(SchematicEntityContext context); - Vec3d getPos(); + Vec3 getPos(); @Nonnull default List computeRequiredItems() { @@ -34,12 +32,12 @@ default List computeRequiredFluids() { ISchematicEntity getRotated(Rotation rotation); - Entity build(World world, BlockPos basePos); + Entity build(Level world, BlockPos basePos); - Entity buildWithoutChecks(World world, BlockPos basePos); + Entity buildWithoutChecks(Level world, BlockPos basePos); - NBTTagCompound serializeNBT(); + CompoundTag serializeNBT(); /** @throws InvalidInputDataException If the input data wasn't correct or didn't make sense. */ - void deserializeNBT(NBTTagCompound nbt) throws InvalidInputDataException; + void deserializeNBT(CompoundTag nbt) throws InvalidInputDataException; } diff --git a/api/buildcraft/api/schematics/SchematicBlockContext.java b/api/buildcraft/api/schematics/SchematicBlockContext.java index 0ca9853..b50dffe 100644 --- a/api/buildcraft/api/schematics/SchematicBlockContext.java +++ b/api/buildcraft/api/schematics/SchematicBlockContext.java @@ -1,28 +1,29 @@ package buildcraft.api.schematics; -import javax.annotation.Nonnull; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import javax.annotation.Nonnull; -public class SchematicBlockContext { +public class SchematicBlockContext +{ @Nonnull - public final World world; + public final Level world; @Nonnull public final BlockPos basePos; @Nonnull public final BlockPos pos; @Nonnull - public final IBlockState blockState; + public final BlockState blockState; @Nonnull public final Block block; - public SchematicBlockContext(@Nonnull World world, + public SchematicBlockContext(@Nonnull Level world, @Nonnull BlockPos basePos, @Nonnull BlockPos pos, - @Nonnull IBlockState blockState, + @Nonnull BlockState blockState, @Nonnull Block block) { this.world = world; this.basePos = basePos; diff --git a/api/buildcraft/api/schematics/SchematicBlockFactory.java b/api/buildcraft/api/schematics/SchematicBlockFactory.java index bf57fb1..b107284 100644 --- a/api/buildcraft/api/schematics/SchematicBlockFactory.java +++ b/api/buildcraft/api/schematics/SchematicBlockFactory.java @@ -1,11 +1,10 @@ package buildcraft.api.schematics; -import java.util.function.Predicate; -import java.util.function.Supplier; +import net.minecraft.resources.ResourceLocation; import javax.annotation.Nonnull; - -import net.minecraft.util.ResourceLocation; +import java.util.function.Predicate; +import java.util.function.Supplier; public class SchematicBlockFactory implements Comparable> { @Nonnull diff --git a/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java b/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java index d88de20..9ad5f85 100644 --- a/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java +++ b/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java @@ -1,29 +1,34 @@ package buildcraft.api.schematics; +import buildcraft.api.core.BuildCraftAPI; +import com.google.common.collect.ImmutableList; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Block; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; import java.util.Set; -import java.util.TreeSet; +import java.util.concurrent.ConcurrentSkipListSet; import java.util.function.Predicate; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.google.common.collect.ImmutableList; - -import net.minecraft.block.Block; -import net.minecraft.util.ResourceLocation; - -import buildcraft.api.core.BuildCraftAPI; - public class SchematicBlockFactoryRegistry { - private static final Set> FACTORIES = new TreeSet<>(); +// private static final Set> FACTORIES = new TreeSet<>(); + private static final Set> FACTORIES = new ConcurrentSkipListSet<>(); + + // Calen thread safety: sometimes "air" not registered just after BCBuildersSchematics#preInit:registerSchematicFactory("air", 0, SchematicBlockAir::predicate, SchematicBlockAir::new) + public synchronized static Set> getFactoriesSynchronized() + { + return FACTORIES; + } public static void registerFactory(String name, int priority, Predicate predicate, Supplier supplier) { - FACTORIES.add(new SchematicBlockFactory<>( +// FACTORIES.add(new SchematicBlockFactory<>( + getFactoriesSynchronized().add(new SchematicBlockFactory<>( BuildCraftAPI.nameToResourceLocation(name), priority, predicate, @@ -44,13 +49,15 @@ public static void registerFactory(String name, } public static List> getFactories() { - return ImmutableList.copyOf(FACTORIES); +// return ImmutableList.copyOf(FACTORIES); + return ImmutableList.copyOf(getFactoriesSynchronized()); } @Nonnull public static SchematicBlockFactory getFactoryByInstance(S instance) { // noinspection unchecked - return (SchematicBlockFactory) FACTORIES.stream() +// return (SchematicBlockFactory) FACTORIES.stream() + return (SchematicBlockFactory) getFactoriesSynchronized().stream() .filter(schematicBlockFactory -> schematicBlockFactory.clazz == instance.getClass()) .findFirst() .orElseThrow(() -> new IllegalStateException("Didn't find a factory for " + instance.getClass())); @@ -58,7 +65,8 @@ public static SchematicBlockFactory getFactoryByI @Nullable public static SchematicBlockFactory getFactoryByName(ResourceLocation name) { - return FACTORIES.stream() +// return FACTORIES.stream() + return getFactoriesSynchronized().stream() .filter(schematicBlockFactory -> schematicBlockFactory.name.equals(name)) .findFirst() .orElse(null); diff --git a/api/buildcraft/api/schematics/SchematicEntityContext.java b/api/buildcraft/api/schematics/SchematicEntityContext.java index b812556..fa61899 100644 --- a/api/buildcraft/api/schematics/SchematicEntityContext.java +++ b/api/buildcraft/api/schematics/SchematicEntityContext.java @@ -1,20 +1,21 @@ package buildcraft.api.schematics; -import javax.annotation.Nonnull; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.Level; -import net.minecraft.entity.Entity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import javax.annotation.Nonnull; -public class SchematicEntityContext { +public class SchematicEntityContext +{ @Nonnull - public final World world; + public final Level world; @Nonnull public final BlockPos basePos; @Nonnull public final Entity entity; - public SchematicEntityContext(@Nonnull World world, + public SchematicEntityContext(@Nonnull Level world, @Nonnull BlockPos basePos, @Nonnull Entity entity) { this.world = world; diff --git a/api/buildcraft/api/schematics/SchematicEntityFactory.java b/api/buildcraft/api/schematics/SchematicEntityFactory.java index a81a52a..9c64672 100644 --- a/api/buildcraft/api/schematics/SchematicEntityFactory.java +++ b/api/buildcraft/api/schematics/SchematicEntityFactory.java @@ -1,11 +1,10 @@ package buildcraft.api.schematics; -import java.util.function.Predicate; -import java.util.function.Supplier; +import net.minecraft.resources.ResourceLocation; import javax.annotation.Nonnull; - -import net.minecraft.util.ResourceLocation; +import java.util.function.Predicate; +import java.util.function.Supplier; public class SchematicEntityFactory implements Comparable> { @Nonnull diff --git a/api/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java b/api/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java index a5525b1..986a617 100644 --- a/api/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java +++ b/api/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java @@ -1,22 +1,19 @@ package buildcraft.api.schematics; +import buildcraft.api.core.BuildCraftAPI; +import com.google.common.collect.ImmutableList; +import net.minecraft.resources.ResourceLocation; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; import java.util.Set; import java.util.TreeSet; import java.util.function.Predicate; import java.util.function.Supplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.google.common.collect.ImmutableList; - -import net.minecraft.entity.EntityList; -import net.minecraft.util.ResourceLocation; - -import buildcraft.api.core.BuildCraftAPI; - -public class SchematicEntityFactoryRegistry { +public class SchematicEntityFactoryRegistry +{ private static final Set> FACTORIES = new TreeSet<>(); public static void registerFactory(String name, @@ -31,17 +28,19 @@ public static void registerFactory(String name, )); } - public static void registerFactory(String name, - int priority, - List entities, - Supplier supplier) { - registerFactory( - name, - priority, - context -> entities.contains(EntityList.getKey(context.entity)), - supplier - ); - } + // Calen no usage in 1.12.2 + // EntityList.class not present in 1.18.2 +// public static void registerFactory(String name, +// int priority, +// List entities, +// Supplier supplier) { +// registerFactory( +// name, +// priority, +// context -> entities.contains(EntityList.getKey(context.entity)), +// supplier +// ); +// } public static List> getFactories() { return ImmutableList.copyOf(FACTORIES); diff --git a/api/buildcraft/api/statements/IActionExternal.java b/api/buildcraft/api/statements/IActionExternal.java index 9086612..0795ddb 100644 --- a/api/buildcraft/api/statements/IActionExternal.java +++ b/api/buildcraft/api/statements/IActionExternal.java @@ -4,9 +4,9 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.statements; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.entity.BlockEntity; public interface IActionExternal extends IAction { - void actionActivate(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); + void actionActivate(BlockEntity target, Direction side, IStatementContainer source, IStatementParameter[] parameters); } diff --git a/api/buildcraft/api/statements/IActionInternalSided.java b/api/buildcraft/api/statements/IActionInternalSided.java index 0ae3d70..571cabb 100644 --- a/api/buildcraft/api/statements/IActionInternalSided.java +++ b/api/buildcraft/api/statements/IActionInternalSided.java @@ -1,7 +1,7 @@ package buildcraft.api.statements; -import net.minecraft.util.EnumFacing; +import net.minecraft.core.Direction; public interface IActionInternalSided extends IAction { - void actionActivate(EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); + void actionActivate(Direction side, IStatementContainer source, IStatementParameter[] parameters); } diff --git a/api/buildcraft/api/statements/IActionProvider.java b/api/buildcraft/api/statements/IActionProvider.java index fa550ff..cccf53f 100644 --- a/api/buildcraft/api/statements/IActionProvider.java +++ b/api/buildcraft/api/statements/IActionProvider.java @@ -4,17 +4,17 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.statements; -import java.util.Collection; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.entity.BlockEntity; import javax.annotation.Nonnull; +import java.util.Collection; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -public interface IActionProvider { +public interface IActionProvider +{ void addInternalActions(Collection actions, IStatementContainer container); - void addInternalSidedActions(Collection actions, IStatementContainer container, @Nonnull EnumFacing side); + void addInternalSidedActions(Collection actions, IStatementContainer container, @Nonnull Direction side); - void addExternalActions(Collection actions, @Nonnull EnumFacing side, TileEntity tile); + void addExternalActions(Collection actions, @Nonnull Direction side, BlockEntity tile); } diff --git a/api/buildcraft/api/statements/IActionReceptor.java b/api/buildcraft/api/statements/IActionReceptor.java index 34155b8..9a53b4d 100644 --- a/api/buildcraft/api/statements/IActionReceptor.java +++ b/api/buildcraft/api/statements/IActionReceptor.java @@ -4,6 +4,7 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.statements; -public interface IActionReceptor { +public interface IActionReceptor +{ void actionActivated(IStatement statement, IStatementParameter[] parameters); } diff --git a/api/buildcraft/api/statements/IGuiSlot.java b/api/buildcraft/api/statements/IGuiSlot.java index f5cb3b2..b6c1195 100644 --- a/api/buildcraft/api/statements/IGuiSlot.java +++ b/api/buildcraft/api/statements/IGuiSlot.java @@ -1,40 +1,70 @@ package buildcraft.api.statements; -import java.util.List; +import buildcraft.api.core.IConvertable; +import buildcraft.api.core.render.ISprite; +import com.google.common.collect.ImmutableList; +import net.minecraft.network.chat.BaseComponent; +import net.minecraft.network.chat.Component; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.Nullable; +import java.util.List; -import com.google.common.collect.ImmutableList; +public interface IGuiSlot extends IConvertable +{ + /** + * Every statement needs a unique tag, it should be in the format of "<modid>:<name>". + * + * @return the unique id + */ + BaseComponent getUniqueTag(); -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; + /** + * Return the description in the UI. Note that this should NEVER be called directly, instead this acts as a bridge + * for {@link #getTooltip()}. (As such this might return null or throw an exception) + */ + @OnlyIn(Dist.CLIENT) +// String getDescription(); + Component getDescription(); -import buildcraft.api.core.IConvertable; -import buildcraft.api.core.render.ISprite; + // Calen + @OnlyIn(Dist.CLIENT) + String getDescriptionKey(); -public interface IGuiSlot extends IConvertable { - /** Every statement needs a unique tag, it should be in the format of "<modid>:<name>". - * - * @return the unique id */ - String getUniqueTag(); - - /** Return the description in the UI. Note that this should NEVER be called directly, instead this acts as a bridge - * for {@link #getTooltip()}. (As such this might return null or throw an exception) */ - @SideOnly(Side.CLIENT) - String getDescription(); - - /** @return The full tooltip for the UI. */ - @SideOnly(Side.CLIENT) - default List getTooltip() { - String desc = getDescription(); - if (desc == null) { + /** + * @return The full tooltip for the UI. + */ + @OnlyIn(Dist.CLIENT) + default List getTooltip() + { +// String desc = getDescription(); + Component desc = getDescription(); + if (desc == null) + { + return ImmutableList.of(); + } +// return ImmutableList.of(new TextComponent(desc)); + return ImmutableList.of(desc); + } + + // Calen + @OnlyIn(Dist.CLIENT) + default List getTooltipKey() + { + String desc = getDescriptionKey(); + if (desc == null) + { return ImmutableList.of(); } +// return ImmutableList.of(new TextComponent(desc)); return ImmutableList.of(desc); } - /** @return A sprite to show in a GUI, or null if this should not render a sprite. */ - @SideOnly(Side.CLIENT) + /** + * @return A sprite to show in a GUI, or null if this should not render a sprite. + */ + @OnlyIn(Dist.CLIENT) @Nullable ISprite getSprite(); } diff --git a/api/buildcraft/api/statements/IOverrideDefaultStatements.java b/api/buildcraft/api/statements/IOverrideDefaultStatements.java index cb2dc78..0d40d7d 100644 --- a/api/buildcraft/api/statements/IOverrideDefaultStatements.java +++ b/api/buildcraft/api/statements/IOverrideDefaultStatements.java @@ -6,7 +6,8 @@ import java.util.List; -public interface IOverrideDefaultStatements { +public interface IOverrideDefaultStatements +{ List overrideTriggers(); List overrideActions(); diff --git a/api/buildcraft/api/statements/IStatementContainer.java b/api/buildcraft/api/statements/IStatementContainer.java index e08a7e8..378f72f 100644 --- a/api/buildcraft/api/statements/IStatementContainer.java +++ b/api/buildcraft/api/statements/IStatementContainer.java @@ -4,15 +4,16 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.statements; -import javax.annotation.Nullable; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import javax.annotation.Nullable; /** This is implemented by objects containing Statements, such as Gates and TileEntities. */ -public interface IStatementContainer { - TileEntity getTile(); +public interface IStatementContainer +{ + BlockEntity getTile(); @Nullable - TileEntity getNeighbourTile(EnumFacing side); + BlockEntity getNeighbourTile(Direction side); } diff --git a/api/buildcraft/api/statements/IStatementParameter.java b/api/buildcraft/api/statements/IStatementParameter.java index d90b380..ef7ae9a 100755 --- a/api/buildcraft/api/statements/IStatementParameter.java +++ b/api/buildcraft/api/statements/IStatementParameter.java @@ -4,14 +4,13 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.statements; -import javax.annotation.Nonnull; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; - import buildcraft.api.statements.StatementManager.IParamReaderBuf; import buildcraft.api.statements.StatementManager.IParameterReader; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.item.ItemStack; + +import javax.annotation.Nonnull; public interface IStatementParameter extends IGuiSlot { @@ -31,20 +30,20 @@ default DrawType getDrawType() { IStatementParameter onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse); - void writeToNbt(NBTTagCompound nbt); + void writeToNbt(CompoundTag nbt); - /** Writes this parameter to the given {@link PacketBuffer}. The default implementation writes out the value of - * {@link #writeToNbt(NBTTagCompound)}, and that will be passed back into - * {@link IParameterReader#readFromNbt(NBTTagCompound)}. + /** Writes this parameter to the given {@link FriendlyByteBuf}. The default implementation writes out the value of + * {@link #writeToNbt(CompoundTag)}, and that will be passed back into + * {@link IParameterReader#readFromNbt(CompoundTag)}. *

* It is likely that implementors can write a more compact form of themselves, so they are encouraged to override * this and also register an {@link IParamReaderBuf} in * {@link StatementManager#registerParameter(String, IParamReaderBuf)} or * {@link StatementManager#registerParameter(IParameterReader, IParamReaderBuf)} */ - default void writeToBuf(PacketBuffer buffer) { - NBTTagCompound nbt = new NBTTagCompound(); + default void writeToBuf(FriendlyByteBuf buffer) { + CompoundTag nbt = new CompoundTag(); writeToNbt(nbt); - buffer.writeCompoundTag(nbt); + buffer.writeNbt(nbt); } /** This returns the parameter after a left rotation. Used in particular in blueprints orientation. */ diff --git a/api/buildcraft/api/statements/ITriggerExternal.java b/api/buildcraft/api/statements/ITriggerExternal.java index 87a848f..453371a 100644 --- a/api/buildcraft/api/statements/ITriggerExternal.java +++ b/api/buildcraft/api/statements/ITriggerExternal.java @@ -4,11 +4,11 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.statements; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.entity.BlockEntity; public interface ITriggerExternal extends ITrigger { - boolean isTriggerActive(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); + boolean isTriggerActive(BlockEntity target, Direction side, IStatementContainer source, IStatementParameter[] parameters); } diff --git a/api/buildcraft/api/statements/ITriggerExternalOverride.java b/api/buildcraft/api/statements/ITriggerExternalOverride.java index 9b1fd1e..ed38f56 100644 --- a/api/buildcraft/api/statements/ITriggerExternalOverride.java +++ b/api/buildcraft/api/statements/ITriggerExternalOverride.java @@ -1,16 +1,17 @@ package buildcraft.api.statements; -import net.minecraft.util.EnumFacing; +import net.minecraft.core.Direction; /** This interface can be used by tiles to override external trigger behaviour. * * Please use wisely. */ -public interface ITriggerExternalOverride { +public interface ITriggerExternalOverride +{ enum Result { TRUE, FALSE, IGNORE } - Result override(EnumFacing side, IStatementContainer source, ITriggerExternal trigger, IStatementParameter[] parameters); + Result override(Direction side, IStatementContainer source, ITriggerExternal trigger, IStatementParameter[] parameters); } diff --git a/api/buildcraft/api/statements/ITriggerInternalSided.java b/api/buildcraft/api/statements/ITriggerInternalSided.java index 73459f0..7298c30 100644 --- a/api/buildcraft/api/statements/ITriggerInternalSided.java +++ b/api/buildcraft/api/statements/ITriggerInternalSided.java @@ -1,7 +1,7 @@ package buildcraft.api.statements; -import net.minecraft.util.EnumFacing; +import net.minecraft.core.Direction; public interface ITriggerInternalSided extends ITrigger { - boolean isTriggerActive(EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); + boolean isTriggerActive(Direction side, IStatementContainer source, IStatementParameter[] parameters); } diff --git a/api/buildcraft/api/statements/ITriggerProvider.java b/api/buildcraft/api/statements/ITriggerProvider.java index 8f3bf03..d2c1bfc 100644 --- a/api/buildcraft/api/statements/ITriggerProvider.java +++ b/api/buildcraft/api/statements/ITriggerProvider.java @@ -4,18 +4,18 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.statements; -import java.util.Collection; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.entity.BlockEntity; import javax.annotation.Nonnull; +import java.util.Collection; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -public interface ITriggerProvider { +public interface ITriggerProvider +{ void addInternalTriggers(Collection triggers, IStatementContainer container); - void addInternalSidedTriggers(Collection triggers, IStatementContainer container, @Nonnull EnumFacing side); + void addInternalSidedTriggers(Collection triggers, IStatementContainer container, @Nonnull Direction side); - /** Returns the list of triggers available to a gate next to the given block. */ - void addExternalTriggers(Collection triggers, @Nonnull EnumFacing side, TileEntity tile); + /** Returns the list of triggers available to a gate next to the given core. */ + void addExternalTriggers(Collection triggers, @Nonnull Direction side, BlockEntity tile); } diff --git a/api/buildcraft/api/statements/StatementManager.java b/api/buildcraft/api/statements/StatementManager.java index 49f0915..36f0720 100644 --- a/api/buildcraft/api/statements/StatementManager.java +++ b/api/buildcraft/api/statements/StatementManager.java @@ -4,24 +4,24 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.statements; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.world.level.block.entity.BlockEntity; -public final class StatementManager { +import java.io.IOException; +import java.util.*; +public final class StatementManager +{ + // Calen: Thread Safety -> InvalidInputDataException: Unknown paramater type buildcraft:fillerParameterYDir public static Map statements = new HashMap<>(); +// public static Map statements = new ConcurrentHashMap<>(); public static Map parameters = new HashMap<>(); +// public static Map parameters = new ConcurrentHashMap<>(); public static Map paramsBuf = new HashMap<>(); +// public static Map paramsBuf = new ConcurrentHashMap<>(); private static List triggerProviders = new LinkedList<>(); private static List actionProviders = new LinkedList<>(); @@ -31,12 +31,12 @@ public final class StatementManager { @FunctionalInterface public interface IParameterReader { - IStatementParameter readFromNbt(NBTTagCompound nbt); + IStatementParameter readFromNbt(CompoundTag nbt); } @FunctionalInterface public interface IParamReaderBuf { - IStatementParameter readFromBuf(PacketBuffer buffer) throws IOException; + IStatementParameter readFromBuf(FriendlyByteBuf buffer) throws IOException; } /** Deactivate constructor */ @@ -55,28 +55,28 @@ public static void registerActionProvider(IActionProvider provider) { } public static void registerStatement(IStatement statement) { - statements.put(statement.getUniqueTag(), statement); + statements.put(statement.getUniqueTag().getString(), statement); } public static void registerParameter(IParameterReader reader) { - registerParameter(reader, buf -> reader.readFromNbt(buf.readCompoundTag())); + registerParameter(reader, buf -> reader.readFromNbt(buf.readNbt())); } public static void registerParameter(IParameterReader reader, IParamReaderBuf bufReader) { - String name = reader.readFromNbt(new NBTTagCompound()).getUniqueTag(); + Component name = reader.readFromNbt(new CompoundTag()).getUniqueTag(); registerParameter(name, reader); registerParameter(name, bufReader); } - public static void registerParameter(String name, IParameterReader reader) { - parameters.put(name, reader); + public static void registerParameter(Component name, IParameterReader reader) { + parameters.put(name.getString(), reader); } - public static void registerParameter(String name, IParamReaderBuf reader) { - paramsBuf.put(name, reader); + public static void registerParameter(Component name, IParamReaderBuf reader) { + paramsBuf.put(name.getString(), reader); } - public static List getExternalTriggers(EnumFacing side, TileEntity entity) { + public static List getExternalTriggers(Direction side, BlockEntity entity) { if (entity instanceof IOverrideDefaultStatements) { List result = ((IOverrideDefaultStatements) entity).overrideTriggers(); if (result != null) { @@ -93,7 +93,7 @@ public static List getExternalTriggers(EnumFacing side, TileEn return new ArrayList<>(triggers); } - public static List getExternalActions(EnumFacing side, TileEntity entity) { + public static List getExternalActions(Direction side, BlockEntity entity) { if (entity instanceof IOverrideDefaultStatements) { List result = ((IOverrideDefaultStatements) entity).overrideActions(); if (result != null) { @@ -130,7 +130,7 @@ public static List getInternalActions(IStatementContainer conta return new ArrayList<>(actions); } - public static List getInternalSidedTriggers(IStatementContainer container, EnumFacing side) { + public static List getInternalSidedTriggers(IStatementContainer container, Direction side) { LinkedHashSet triggers = new LinkedHashSet<>(); for (ITriggerProvider provider : triggerProviders) { @@ -140,7 +140,7 @@ public static List getInternalSidedTriggers(IStatementCon return new ArrayList<>(triggers); } - public static List getInternalSidedActions(IStatementContainer container, EnumFacing side) { + public static List getInternalSidedActions(IStatementContainer container, Direction side) { LinkedHashSet actions = new LinkedHashSet<>(); for (IActionProvider provider : actionProviders) { diff --git a/api/buildcraft/api/statements/StatementMouseClick.java b/api/buildcraft/api/statements/StatementMouseClick.java index c39ed33..3ecc746 100644 --- a/api/buildcraft/api/statements/StatementMouseClick.java +++ b/api/buildcraft/api/statements/StatementMouseClick.java @@ -4,7 +4,8 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.statements; -public final class StatementMouseClick { +public final class StatementMouseClick +{ private int button; private boolean shift; diff --git a/api/buildcraft/api/statements/StatementParameterItemStack.java b/api/buildcraft/api/statements/StatementParameterItemStack.java index 253bd46..d48bd66 100755 --- a/api/buildcraft/api/statements/StatementParameterItemStack.java +++ b/api/buildcraft/api/statements/StatementParameterItemStack.java @@ -1,35 +1,41 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** + * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ + * should be located as "LICENSE.API" in the BuildCraft source code distribution. + */ package buildcraft.api.statements; -import java.util.List; -import java.util.Objects; - -import javax.annotation.Nonnull; - +import buildcraft.api.core.render.ISprite; import com.google.common.collect.ImmutableList; +import net.minecraft.ChatFormatting; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.BaseComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.text.TextFormatting; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import buildcraft.api.core.render.ISprite; +import javax.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; -public class StatementParameterItemStack implements IStatementParameter { +public class StatementParameterItemStack implements IStatementParameter +{ // needed because ItemStack.EMPTY doesn't have @Nonnull applied to it :/ @Nonnull private static final ItemStack EMPTY_STACK; - /** Immutable parameter that has the {@link ItemStack#EMPTY} as it's {@link #stack}. */ + /** + * Immutable parameter that has the {@link ItemStack#EMPTY} as it's {@link #stack}. + */ public static final StatementParameterItemStack EMPTY; - static { + static + { ItemStack stack = ItemStack.EMPTY; if (stack == null) throw new Error("Somehow ItemStack.EMPTY was null!"); EMPTY_STACK = stack; @@ -39,50 +45,64 @@ public class StatementParameterItemStack implements IStatementParameter { @Nonnull protected final ItemStack stack; - public StatementParameterItemStack() { + public StatementParameterItemStack() + { stack = EMPTY_STACK; } - public StatementParameterItemStack(@Nonnull ItemStack stack) { + public StatementParameterItemStack(@Nonnull ItemStack stack) + { this.stack = stack; } - public StatementParameterItemStack(NBTTagCompound nbt) { - ItemStack read = new ItemStack(nbt.getCompoundTag("stack")); - if (read.isEmpty()) { + public StatementParameterItemStack(CompoundTag nbt) + { + ItemStack read = ItemStack.of(nbt.getCompound("stack")); + if (read.isEmpty()) + { stack = EMPTY_STACK; - } else { + } + else + { stack = read; } } @Override - public void writeToNbt(NBTTagCompound compound) { - if (!stack.isEmpty()) { - NBTTagCompound tagCompound = new NBTTagCompound(); - stack.writeToNBT(tagCompound); - compound.setTag("stack", tagCompound); + public void writeToNbt(CompoundTag compound) + { + if (!stack.isEmpty()) + { + CompoundTag tagCompound = new CompoundTag(); + stack.save(tagCompound); + compound.put("stack", tagCompound); } } @Override - public ISprite getSprite() { + public ISprite getSprite() + { return null; } @Override @Nonnull - public ItemStack getItemStack() { + public ItemStack getItemStack() + { return stack; } @Override public StatementParameterItemStack onClick( - IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse - ) { - if (stack.isEmpty()) { + IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse + ) + { + if (stack.isEmpty()) + { return EMPTY; - } else { + } + else + { ItemStack newStack = stack.copy(); newStack.setCount(1); return new StatementParameterItemStack(newStack); @@ -90,56 +110,94 @@ public StatementParameterItemStack onClick( } @Override - public boolean equals(Object object) { - if (object instanceof StatementParameterItemStack) { + public boolean equals(Object object) + { + if (object instanceof StatementParameterItemStack) + { StatementParameterItemStack param = (StatementParameterItemStack) object; - return ItemStack.areItemStacksEqual(stack, param.stack) - && ItemStack.areItemStackTagsEqual(stack, param.stack); - } else { + return ItemStack.isSameItemSameTags(stack, param.stack); + } + else + { return false; } } @Override - public int hashCode() { + public int hashCode() + { return Objects.hashCode(stack); } @Override - @SideOnly(Side.CLIENT) - public String getDescription() { + @OnlyIn(Dist.CLIENT) + public Component getDescription() + { + throw new UnsupportedOperationException("Don't call getDescription directly!"); + } + @Override + @OnlyIn(Dist.CLIENT) + public String getDescriptionKey() + { throw new UnsupportedOperationException("Don't call getDescription directly!"); } @Override - @SideOnly(Side.CLIENT) - public List getTooltip() { - if (stack.isEmpty()) { + @OnlyIn(Dist.CLIENT) + public List getTooltip() + { + if (stack.isEmpty()) + { return ImmutableList.of(); } - List tooltip = stack.getTooltip(null, ITooltipFlag.TooltipFlags.NORMAL); - if (!tooltip.isEmpty()) { - tooltip.set(0, stack.getRarity().rarityColor + tooltip.get(0)); - for (int i = 1; i < tooltip.size(); i++) { - tooltip.set(i, TextFormatting.GRAY + tooltip.get(i)); + List tooltip = stack.getTooltipLines(null, TooltipFlag.Default.NORMAL); + if (!tooltip.isEmpty()) + { + tooltip.set(0, new TextComponent(stack.getRarity().color.toString()).append(tooltip.get(0))); + for (int i = 1; i < tooltip.size(); i++) + { + tooltip.set(i, new TextComponent(ChatFormatting.GRAY.toString()).append(tooltip.get(i))); } } return tooltip; } + @Override + @OnlyIn(Dist.CLIENT) + public List getTooltipKey() + { + if (stack.isEmpty()) + { + return ImmutableList.of(); + } + List tooltip = stack.getTooltipLines(null, TooltipFlag.Default.NORMAL); + List toolTipRet = new ArrayList<>(tooltip.size()); + if (!tooltip.isEmpty()) + { + toolTipRet.set(0, new TextComponent(stack.getRarity().color.toString()).append(tooltip.get(0)).getString()); + for (int i = 1; i < tooltip.size(); i++) + { + toolTipRet.set(i, new TextComponent(ChatFormatting.GRAY.toString()).append(tooltip.get(i)).getString()); + } + } + return toolTipRet; + } @Override - public String getUniqueTag() { - return "buildcraft:stack"; + public BaseComponent getUniqueTag() + { + return new TextComponent("buildcraft:stack"); } @Override - public IStatementParameter rotateLeft() { + public IStatementParameter rotateLeft() + { return this; } @Override - public IStatementParameter[] getPossible(IStatementContainer source) { + public IStatementParameter[] getPossible(IStatementContainer source) + { return null; } } diff --git a/api/buildcraft/api/statements/StatementSlot.java b/api/buildcraft/api/statements/StatementSlot.java index b3306b4..da0bcb7 100755 --- a/api/buildcraft/api/statements/StatementSlot.java +++ b/api/buildcraft/api/statements/StatementSlot.java @@ -4,12 +4,14 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.statements; -import java.util.Arrays; -import java.util.Objects; import buildcraft.api.core.EnumPipePart; -public class StatementSlot { +import java.util.Arrays; +import java.util.Objects; + +public class StatementSlot +{ public IStatement statement; public IStatementParameter[] parameters; public EnumPipePart part = EnumPipePart.CENTER; diff --git a/api/buildcraft/api/statements/containers/IFillerStatementContainer.java b/api/buildcraft/api/statements/containers/IFillerStatementContainer.java index 475a01d..05255ed 100644 --- a/api/buildcraft/api/statements/containers/IFillerStatementContainer.java +++ b/api/buildcraft/api/statements/containers/IFillerStatementContainer.java @@ -1,23 +1,22 @@ package buildcraft.api.statements.containers; -import javax.annotation.Nullable; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - import buildcraft.api.core.IBox; import buildcraft.api.filler.IFillerPattern; import buildcraft.api.statements.IStatementContainer; import buildcraft.api.statements.IStatementParameter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; + +import javax.annotation.Nullable; public interface IFillerStatementContainer extends IStatementContainer { /** Unlike in {@link IStatementContainer} some containers might not be tile based (for example the volume box). */ @Override @Nullable - TileEntity getTile(); + BlockEntity getTile(); - World getFillerWorld(); + Level getFillerWorld(); /** @return True if this filler has a non-zero sized box. */ boolean hasBox(); diff --git a/api/buildcraft/api/statements/containers/IRedstoneStatementContainer.java b/api/buildcraft/api/statements/containers/IRedstoneStatementContainer.java index 1d7989a..cfd57f1 100644 --- a/api/buildcraft/api/statements/containers/IRedstoneStatementContainer.java +++ b/api/buildcraft/api/statements/containers/IRedstoneStatementContainer.java @@ -1,17 +1,18 @@ package buildcraft.api.statements.containers; -import net.minecraft.util.EnumFacing; +import net.minecraft.core.Direction; -public interface IRedstoneStatementContainer { +public interface IRedstoneStatementContainer +{ /** Get the redstone input from a given side. * * @param side The side - use "null" for maximum input. * @return The redstone input, from 0 to 15. */ - int getRedstoneInput(EnumFacing side); + int getRedstoneInput(Direction side); /** Set the redstone input for a given side. * * @param side The side - use "null" for all sides. * @return Whether the set was successful. */ - boolean setRedstoneOutput(EnumFacing side, int value); + boolean setRedstoneOutput(Direction side, int value); } diff --git a/api/buildcraft/api/statements/containers/ISidedStatementContainer.java b/api/buildcraft/api/statements/containers/ISidedStatementContainer.java index b65ace4..ffa23af 100644 --- a/api/buildcraft/api/statements/containers/ISidedStatementContainer.java +++ b/api/buildcraft/api/statements/containers/ISidedStatementContainer.java @@ -1,10 +1,9 @@ package buildcraft.api.statements.containers; -import net.minecraft.util.EnumFacing; - import buildcraft.api.statements.IStatementContainer; +import net.minecraft.core.Direction; /** Created by asie on 3/14/15. */ public interface ISidedStatementContainer extends IStatementContainer { - EnumFacing getSide(); + Direction getSide(); } diff --git a/api/buildcraft/api/statements/package-info.java b/api/buildcraft/api/statements/package-info.java index 64642d7..5bc8cbf 100644 --- a/api/buildcraft/api/statements/package-info.java +++ b/api/buildcraft/api/statements/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_statements") +//@API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_statements") package buildcraft.api.statements; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/template/ITemplateHandler.java b/api/buildcraft/api/template/ITemplateHandler.java index e0dac1b..3674b45 100644 --- a/api/buildcraft/api/template/ITemplateHandler.java +++ b/api/buildcraft/api/template/ITemplateHandler.java @@ -6,11 +6,11 @@ package buildcraft.api.template; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; public interface ITemplateHandler { - boolean handle(World world, BlockPos pos, EntityPlayer player, ItemStack stack); + boolean handle(Level world, BlockPos pos, Player player, ItemStack stack); } diff --git a/api/buildcraft/api/template/ITemplateRegistry.java b/api/buildcraft/api/template/ITemplateRegistry.java index ec6d250..0e62d99 100644 --- a/api/buildcraft/api/template/ITemplateRegistry.java +++ b/api/buildcraft/api/template/ITemplateRegistry.java @@ -6,12 +6,11 @@ package buildcraft.api.template; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - import buildcraft.api.core.EnumHandlerPriority; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; public interface ITemplateRegistry { /** Adds a handler with a {@link EnumHandlerPriority} of {@linkplain EnumHandlerPriority#NORMAL} */ @@ -21,5 +20,5 @@ default void addHandler(ITemplateHandler handler) { void addHandler(ITemplateHandler handler, EnumHandlerPriority priority); - boolean handle(World world, BlockPos pos, EntityPlayer player, ItemStack stack); + boolean handle(Level world, BlockPos pos, Player player, ItemStack stack); } diff --git a/api/buildcraft/api/tiles/IControllable.java b/api/buildcraft/api/tiles/IControllable.java index 465097e..bffb8f4 100644 --- a/api/buildcraft/api/tiles/IControllable.java +++ b/api/buildcraft/api/tiles/IControllable.java @@ -8,7 +8,8 @@ /** This interface should be implemented by any Tile Entity which wishes to have non-redstone automation (for example, * BuildCraft Gates, but also other mods which implement it, e.g. OpenComputers). */ -public interface IControllable { +public interface IControllable +{ enum Mode { ON, OFF, diff --git a/api/buildcraft/api/tiles/IDebuggable.java b/api/buildcraft/api/tiles/IDebuggable.java index 8a9f2dc..129f293 100644 --- a/api/buildcraft/api/tiles/IDebuggable.java +++ b/api/buildcraft/api/tiles/IDebuggable.java @@ -1,23 +1,31 @@ package buildcraft.api.tiles; -import java.util.List; - -import net.minecraft.util.EnumFacing; +import net.minecraft.core.Direction; +import net.minecraft.network.chat.Component; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; -public interface IDebuggable { - /** Get the debug information from a tile entity as a list of strings, used for the F3 debug menu. The left and +public interface IDebuggable +{ + /** + * Get the debug information from a tile entity as a list of strings, used for the F3 debug menu. The left and * right parameters correspond to the sides of the F3 screen. - * - * @param side The side the block was clicked on, may be null if we don't know, or is the "centre" side */ - void getDebugInfo(List left, List right, EnumFacing side); + * + * @param side The side the core was clicked on, may be null if we don't know, or is the "centre" side + */ + // Calen: I18n.class doesn't exist in Server Side +// void getDebugInfo(List left, List right, Direction side); + void getDebugInfo(List left, List right, Direction side); - /** Same as {@link #getDebugInfo(List, List, EnumFacing)}, but only for client + /** + * Same as {@link #getDebugInfo(List, List, Direction)}, but only for client * - * @param side same as for {@link #getDebugInfo(List, List, EnumFacing)} */ - @SideOnly(Side.CLIENT) - default void getClientDebugInfo(List left, List right, EnumFacing side) { + * @param side same as for {@link #getDebugInfo(List, List, Direction)} + */ + @OnlyIn(Dist.CLIENT) + default void getClientDebugInfo(List left, List right, Direction side) + { } } diff --git a/api/buildcraft/api/tiles/IHasWork.java b/api/buildcraft/api/tiles/IHasWork.java index fa87196..4ab940b 100644 --- a/api/buildcraft/api/tiles/IHasWork.java +++ b/api/buildcraft/api/tiles/IHasWork.java @@ -6,7 +6,8 @@ /** This interface should be implemented by any Tile Entity which carries out work (crafting, ore processing, mining, et * cetera). */ -public interface IHasWork { +public interface IHasWork +{ /** Check if the Tile Entity is currently doing any work. * * @return True if the Tile Entity is doing work. */ diff --git a/api/buildcraft/api/tiles/IHeatable.java b/api/buildcraft/api/tiles/IHeatable.java index d789ab5..0d8c1b2 100644 --- a/api/buildcraft/api/tiles/IHeatable.java +++ b/api/buildcraft/api/tiles/IHeatable.java @@ -5,7 +5,8 @@ package buildcraft.api.tiles; /** This interface should be implemented by Tile Entities which have an internal heat value. */ -public interface IHeatable { +public interface IHeatable +{ /** @return The minimum heat value, in degrees. */ double getMinHeatValue(); diff --git a/api/buildcraft/api/tiles/ITileAreaProvider.java b/api/buildcraft/api/tiles/ITileAreaProvider.java index 89a7c14..a522294 100644 --- a/api/buildcraft/api/tiles/ITileAreaProvider.java +++ b/api/buildcraft/api/tiles/ITileAreaProvider.java @@ -1,10 +1,11 @@ package buildcraft.api.tiles; -import net.minecraft.util.math.BlockPos; import buildcraft.api.core.IAreaProvider; +import net.minecraft.core.BlockPos; /** Used for more fine-grained control of whether or not a machine connects to the provider here. */ -public interface ITileAreaProvider extends IAreaProvider { +public interface ITileAreaProvider extends IAreaProvider +{ boolean isValidFromLocation(BlockPos pos); } diff --git a/api/buildcraft/api/tiles/TilesAPI.java b/api/buildcraft/api/tiles/TilesAPI.java index abacf92..7aee4b3 100644 --- a/api/buildcraft/api/tiles/TilesAPI.java +++ b/api/buildcraft/api/tiles/TilesAPI.java @@ -1,28 +1,53 @@ package buildcraft.api.tiles; -import javax.annotation.Nonnull; - +import buildcraft.lib.BCLib; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.CapabilityToken; +import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; -import buildcraft.api.core.CapabilitiesHelper; +import javax.annotation.Nonnull; -public class TilesAPI { +@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = BCLib.MODID) // Calen add for reg caps +public class TilesAPI +{ @Nonnull - public static final Capability CAP_CONTROLLABLE; + public static final Capability CAP_CONTROLLABLE = CapabilityManager.get(new CapabilityToken<>() + { + }); @Nonnull - public static final Capability CAP_HAS_WORK; + public static final Capability CAP_HAS_WORK = CapabilityManager.get(new CapabilityToken<>() + { + }); @Nonnull - public static final Capability CAP_HEATABLE; + public static final Capability CAP_HEATABLE = CapabilityManager.get(new CapabilityToken<>() + { + }); @Nonnull - public static final Capability CAP_TILE_AREA_PROVIDER; - - static { - CAP_CONTROLLABLE = CapabilitiesHelper.registerCapability(IControllable.class); - CAP_HAS_WORK = CapabilitiesHelper.registerCapability(IHasWork.class); - CAP_HEATABLE = CapabilitiesHelper.registerCapability(IHeatable.class); - CAP_TILE_AREA_PROVIDER = CapabilitiesHelper.registerCapability(ITileAreaProvider.class); + public static final Capability CAP_TILE_AREA_PROVIDER = CapabilityManager.get(new CapabilityToken<>() + { + }); + + // Calen: 1.18.2直接用CapabilityManager.get获取? +// static { +// CAP_CONTROLLABLE = CapabilitiesHelper.registerCapability(IControllable.class); +// CAP_HAS_WORK = CapabilitiesHelper.registerCapability(IHasWork.class); +// CAP_HEATABLE = CapabilitiesHelper.registerCapability(IHeatable.class); +// CAP_TILE_AREA_PROVIDER = CapabilitiesHelper.registerCapability(ITileAreaProvider.class); +// } + + // Calen + @SubscribeEvent + public static void registerCapability(RegisterCapabilitiesEvent event) + { + event.register(IControllable.class); + event.register(IHasWork.class); + event.register(IHeatable.class); + event.register(ITileAreaProvider.class); } } diff --git a/api/buildcraft/api/tiles/package-info.java b/api/buildcraft/api/tiles/package-info.java index ad60078..6b886dc 100644 --- a/api/buildcraft/api/tiles/package-info.java +++ b/api/buildcraft/api/tiles/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.2", owner = "buildcraftapi_core", provides = "buildcraftapi_tiles") +//@API(apiVersion = "1.2", owner = "buildcraftapi_core", provides = "buildcraftapi_tiles") package buildcraft.api.tiles; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/tools/IToolWrench.java b/api/buildcraft/api/tools/IToolWrench.java index 9201b55..ae63a72 100644 --- a/api/buildcraft/api/tools/IToolWrench.java +++ b/api/buildcraft/api/tools/IToolWrench.java @@ -4,13 +4,14 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.tools; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumHand; -import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.HitResult; /*** Implement this interface on subclasses of Item to have that item work as a wrench for buildcraft */ -public interface IToolWrench { +public interface IToolWrench +{ /*** Called to ensure that the wrench can be used. * @@ -20,7 +21,7 @@ public interface IToolWrench { * @param rayTrace - The object that is being wrenched * * @return true if wrenching is allowed, false if not */ - boolean canWrench(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace); + boolean canWrench(Player player, InteractionHand hand, ItemStack wrench, HitResult rayTrace); /*** Callback after the wrench has been used. This can be used to decrease durability or for other purposes. * @@ -28,5 +29,5 @@ public interface IToolWrench { * @param hand - Which hand was holding the wrench * @param wrench - The item stack that holds the wrench * @param rayTrace - The object that is being wrenched */ - void wrenchUsed(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace); + void wrenchUsed(Player player, InteractionHand hand, ItemStack wrench, HitResult rayTrace); } diff --git a/api/buildcraft/api/tools/package-info.java b/api/buildcraft/api/tools/package-info.java index f089abf..50c20bc 100644 --- a/api/buildcraft/api/tools/package-info.java +++ b/api/buildcraft/api/tools/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_tools") +//@API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_tools") package buildcraft.api.tools; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/transport/EnumWirePart.java b/api/buildcraft/api/transport/EnumWirePart.java index 687ba67..59a3d2f 100644 --- a/api/buildcraft/api/transport/EnumWirePart.java +++ b/api/buildcraft/api/transport/EnumWirePart.java @@ -1,11 +1,13 @@ package buildcraft.api.transport; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumFacing.AxisDirection; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.Vec3d; +import net.minecraft.core.Direction; +import net.minecraft.core.Direction.AxisDirection; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; -public enum EnumWirePart { +public enum EnumWirePart +{ EAST_UP_SOUTH(true, true, true), EAST_UP_NORTH(true, true, false), EAST_DOWN_SOUTH(true, false, true), @@ -19,32 +21,45 @@ public enum EnumWirePart { public final AxisDirection x, y, z; - /** The bounding box for rendering a wire or selecting an already-placed wire. */ - public final AxisAlignedBB boundingBox; + /** + * The bounding box for rendering a wire or selecting an already-placed wire. + */ + public final VoxelShape boundingBox; - /** The bounding box that is used when adding pipe wire to a pipe */ - public final AxisAlignedBB boundingBoxPossible; + /** + * The bounding box that is used when adding pipe wire to a pipe + */ + public final VoxelShape boundingBoxPossible; - EnumWirePart(boolean x, boolean y, boolean z) { + EnumWirePart(boolean x, boolean y, boolean z) + { this.x = x ? AxisDirection.POSITIVE : AxisDirection.NEGATIVE; this.y = y ? AxisDirection.POSITIVE : AxisDirection.NEGATIVE; this.z = z ? AxisDirection.POSITIVE : AxisDirection.NEGATIVE; - double x1 = this.x.getOffset() * (5 / 16.0) + 0.5; - double y1 = this.y.getOffset() * (5 / 16.0) + 0.5; - double z1 = this.z.getOffset() * (5 / 16.0) + 0.5; - double x2 = this.x.getOffset() * (4 / 16.0) + 0.5; - double y2 = this.y.getOffset() * (4 / 16.0) + 0.5; - double z2 = this.z.getOffset() * (4 / 16.0) + 0.5; - this.boundingBox = new AxisAlignedBB(x1, y1, z1, x2, y2, z2); + double x1 = this.x.getStep() * (5 / 16.0) + 0.5; + double y1 = this.y.getStep() * (5 / 16.0) + 0.5; + double z1 = this.z.getStep() * (5 / 16.0) + 0.5; + double x2 = this.x.getStep() * (4 / 16.0) + 0.5; + double y2 = this.y.getStep() * (4 / 16.0) + 0.5; + double z2 = this.z.getStep() * (4 / 16.0) + 0.5; + this.boundingBox = Shapes.box(Math.min(x1, x2), Math.min(y1, y2), Math.min(z1, z2), Math.max(x1, x2), Math.max(y1, y2), Math.max(z1, z2)); - Vec3d center = new Vec3d(0.5, 0.5, 0.5); - Vec3d edge = new Vec3d(x ? 0.75 : 0.25, y ? 0.75 : 0.25, z ? 0.75 : 0.25); - this.boundingBoxPossible = new AxisAlignedBB(center.x, center.y, center.z, edge.x, - edge.y, edge.z); + Vec3 center = new Vec3(0.5, 0.5, 0.5); + Vec3 edge = new Vec3(x ? 0.75 : 0.25, y ? 0.75 : 0.25, z ? 0.75 : 0.25); + this.boundingBoxPossible = Shapes.box( + Math.min(center.x, edge.x), + Math.min(center.y, edge.y), + Math.min(center.z, edge.z), + Math.max(center.x, edge.x), + Math.max(center.y, edge.y), + Math.max(center.z, edge.z) + ); } - public AxisDirection getDirection(EnumFacing.Axis axis) { - switch (axis) { + public AxisDirection getDirection(Direction.Axis axis) + { + switch (axis) + { case X: return x; case Y: @@ -56,24 +71,35 @@ public AxisDirection getDirection(EnumFacing.Axis axis) { } } - public static EnumWirePart get(int x, int y, int z) { + public static EnumWirePart get(int x, int y, int z) + { boolean bx = (x % 2 + 2) % 2 == 1; boolean by = (y % 2 + 2) % 2 == 1; boolean bz = (z % 2 + 2) % 2 == 1; return get(bx, by, bz); } - public static EnumWirePart get(boolean x, boolean y, boolean z) { - if (x) { - if (y) { + public static EnumWirePart get(boolean x, boolean y, boolean z) + { + if (x) + { + if (y) + { return z ? EAST_UP_SOUTH : EAST_UP_NORTH; - } else { + } + else + { return z ? EAST_DOWN_SOUTH : EAST_DOWN_NORTH; } - } else { - if (y) { + } + else + { + if (y) + { return z ? WEST_UP_SOUTH : WEST_UP_NORTH; - } else { + } + else + { return z ? WEST_DOWN_SOUTH : WEST_DOWN_NORTH; } } diff --git a/api/buildcraft/api/transport/IInjectable.java b/api/buildcraft/api/transport/IInjectable.java index 2aeebd6..8ff8da4 100644 --- a/api/buildcraft/api/transport/IInjectable.java +++ b/api/buildcraft/api/transport/IInjectable.java @@ -1,16 +1,18 @@ package buildcraft.api.transport; +import net.minecraft.core.Direction; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.ItemStack; + import javax.annotation.Nonnull; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; /** Interface for pipes to implement if they can accept items in a similar fashion to BC pipes. */ -public interface IInjectable { +public interface IInjectable +{ /** Tests to see if this pipe can accept items from the given direction. Useless to call this if you are going to - * call {@link #injectItem(ItemStack, boolean, EnumFacing, EnumDyeColor, double)} straight after. */ - boolean canInjectItems(EnumFacing from); + * call {@link #injectItem(ItemStack, boolean, Direction, DyeColor, double)} straight after. */ + boolean canInjectItems(Direction from); /** Offers an ItemStack for addition to the pipe. Will be rejected if the pipe doesn't accept items from that side. * This should never be called on the client side! Implementors are free to throw an exception if be called on the @@ -23,5 +25,5 @@ public interface IInjectable { * @param speed The speed of the item to be added (in blocks per tick) or {@code <=0} if a default should be used. * @return The left over stack that was not accepted. */ @Nonnull - ItemStack injectItem(@Nonnull ItemStack stack, boolean doAdd, EnumFacing from, EnumDyeColor color, double speed); + ItemStack injectItem(@Nonnull ItemStack stack, boolean doAdd, Direction from, DyeColor color, double speed); } diff --git a/api/buildcraft/api/transport/IItemPluggable.java b/api/buildcraft/api/transport/IItemPluggable.java index a55a0c4..2a099c5 100644 --- a/api/buildcraft/api/transport/IItemPluggable.java +++ b/api/buildcraft/api/transport/IItemPluggable.java @@ -1,18 +1,18 @@ package buildcraft.api.transport; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; - import buildcraft.api.transport.pipe.IPipeHolder; import buildcraft.api.transport.pluggable.PipePluggable; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** Designates an item that can be placed onto a pipe as a {@link PipePluggable}. */ -public interface IItemPluggable { +public interface IItemPluggable +{ /** Called when this item is placed onto a pipe holder. This can return null if this item does not make a valid * pluggable. Note that if you return a non-null pluggable then it will *definitely* be added to the pipe, and you * are responsible for making all the effects yourself (like the sound effect). @@ -22,6 +22,6 @@ public interface IItemPluggable { * @param side The side that the pluggable should be placed on * @return A pluggable to place onto the pipe */ @Nullable - PipePluggable onPlace(@Nonnull ItemStack stack, IPipeHolder holder, EnumFacing side, EntityPlayer player, - EnumHand hand); + PipePluggable onPlace(@Nonnull ItemStack stack, IPipeHolder holder, Direction side, Player player, + InteractionHand hand); } diff --git a/api/buildcraft/api/transport/IStripesActivator.java b/api/buildcraft/api/transport/IStripesActivator.java index a0dd7c8..a39d034 100644 --- a/api/buildcraft/api/transport/IStripesActivator.java +++ b/api/buildcraft/api/transport/IStripesActivator.java @@ -4,13 +4,13 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.transport; -import javax.annotation.Nonnull; +import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemStack; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import javax.annotation.Nonnull; public interface IStripesActivator { - boolean sendItem(@Nonnull ItemStack itemStack, EnumFacing from); + boolean sendItem(@Nonnull ItemStack itemStack, Direction from); - void dropItem(@Nonnull ItemStack itemStack, EnumFacing from); + void dropItem(@Nonnull ItemStack itemStack, Direction from); } diff --git a/api/buildcraft/api/transport/IStripesHandlerBlock.java b/api/buildcraft/api/transport/IStripesHandlerBlock.java index 888cac4..ab3e410 100644 --- a/api/buildcraft/api/transport/IStripesHandlerBlock.java +++ b/api/buildcraft/api/transport/IStripesHandlerBlock.java @@ -1,9 +1,9 @@ package buildcraft.api.transport; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; public interface IStripesHandlerBlock { @@ -12,7 +12,7 @@ public interface IStripesHandlerBlock { * @param direction * @param player * @param activator - * @return True if this broke a block, false otherwise (note that this handler MUST NOT return false if it has + * @return True if this broke a core, false otherwise (note that this handler MUST NOT return false if it has * changed the world in any way) */ - boolean handle(World world, BlockPos pos, EnumFacing direction, EntityPlayer player, IStripesActivator activator); + boolean handle(Level world, BlockPos pos, Direction direction, Player player, IStripesActivator activator); } diff --git a/api/buildcraft/api/transport/IStripesHandlerItem.java b/api/buildcraft/api/transport/IStripesHandlerItem.java index 6512be8..ff203ba 100644 --- a/api/buildcraft/api/transport/IStripesHandlerItem.java +++ b/api/buildcraft/api/transport/IStripesHandlerItem.java @@ -4,19 +4,19 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.transport; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; public interface IStripesHandlerItem { /** Called to handle the given {@link ItemStack} within the world. Note that the player's inventory will be empty, - * except that the target stack will be set into its {@link EnumHand#MAIN_HAND}. Any items left in the players + * except that the target stack will be set into its {@link InteractionHand#MAIN_HAND}. Any items left in the players * inventory will be returned back through the activator with - * {@link IStripesActivator#sendItem(ItemStack, EnumFacing)} + * {@link IStripesActivator#sendItem(ItemStack, Direction)} * * @param world * @param pos @@ -26,5 +26,5 @@ public interface IStripesHandlerItem { * @param activator * @return True if this used the item, false otherwise (note that this handler MUST NOT return false if it has * changed the world in any way) */ - boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator); + boolean handle(Level world, BlockPos pos, Direction direction, ItemStack stack, Player player, IStripesActivator activator); } diff --git a/api/buildcraft/api/transport/IStripesRegistry.java b/api/buildcraft/api/transport/IStripesRegistry.java index ae69806..360f67d 100644 --- a/api/buildcraft/api/transport/IStripesRegistry.java +++ b/api/buildcraft/api/transport/IStripesRegistry.java @@ -1,12 +1,11 @@ package buildcraft.api.transport; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - import buildcraft.api.core.EnumHandlerPriority; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; public interface IStripesRegistry { /** Adds a handler with a {@link EnumHandlerPriority} of {@linkplain EnumHandlerPriority#NORMAL} */ @@ -25,17 +24,17 @@ default void addHandler(IStripesHandlerBlock handler) { /** @param pos The position of the stripes pipe. * @return True if a handler handled the itemstack, false otherwise (and so nothing has been done) */ - boolean handleItem(World world, + boolean handleItem(Level world, BlockPos pos, - EnumFacing direction, + Direction direction, ItemStack stack, - EntityPlayer player, + Player player, IStripesActivator activator); - /** @return True if a handler broke a block, false otherwise (and so nothing has been done) */ - boolean handleBlock(World world, + /** @return True if a handler broke a core, false otherwise (and so nothing has been done) */ + boolean handleBlock(Level world, BlockPos pos, - EnumFacing direction, - EntityPlayer player, + Direction direction, + Player player, IStripesActivator activator); } diff --git a/api/buildcraft/api/transport/IWireEmitter.java b/api/buildcraft/api/transport/IWireEmitter.java index 4b480e2..7d84c7f 100644 --- a/api/buildcraft/api/transport/IWireEmitter.java +++ b/api/buildcraft/api/transport/IWireEmitter.java @@ -6,13 +6,14 @@ package buildcraft.api.transport; -import net.minecraft.item.EnumDyeColor; +import net.minecraft.world.item.DyeColor; -public interface IWireEmitter { +public interface IWireEmitter +{ /** Checks to see if this wire emitter is currently emitting the given colour. Only used to check if a given emitter * is still active. */ - boolean isEmitting(EnumDyeColor colour); + boolean isEmitting(DyeColor colour); /** Emits the given wire colour this tick. */ - void emitWire(EnumDyeColor colour); + void emitWire(DyeColor colour); } diff --git a/api/buildcraft/api/transport/IWireManager.java b/api/buildcraft/api/transport/IWireManager.java index 942c3ab..b4b7a78 100644 --- a/api/buildcraft/api/transport/IWireManager.java +++ b/api/buildcraft/api/transport/IWireManager.java @@ -1,24 +1,24 @@ package buildcraft.api.transport; -import net.minecraft.item.EnumDyeColor; - import buildcraft.api.transport.pipe.IPipeHolder; +import net.minecraft.world.item.DyeColor; -public interface IWireManager { +public interface IWireManager +{ IPipeHolder getHolder(); void updateBetweens(boolean recursive); - EnumDyeColor getColorOfPart(EnumWirePart part); + DyeColor getColorOfPart(EnumWirePart part); - EnumDyeColor removePart(EnumWirePart part); + DyeColor removePart(EnumWirePart part); - boolean addPart(EnumWirePart part, EnumDyeColor colour); + boolean addPart(EnumWirePart part, DyeColor colour); - boolean hasPartOfColor(EnumDyeColor color); + boolean hasPartOfColor(DyeColor color); boolean isPowered(EnumWirePart part); - boolean isAnyPowered(EnumDyeColor color); + boolean isAnyPowered(DyeColor color); } diff --git a/api/buildcraft/api/transport/WireNode.java b/api/buildcraft/api/transport/WireNode.java index 5430b64..2d7eb9e 100644 --- a/api/buildcraft/api/transport/WireNode.java +++ b/api/buildcraft/api/transport/WireNode.java @@ -1,13 +1,14 @@ package buildcraft.api.transport; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Direction.AxisDirection; + import java.util.EnumMap; import java.util.Map; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumFacing.AxisDirection; -import net.minecraft.util.math.BlockPos; - -public class WireNode { +public class WireNode +{ public final BlockPos pos; public final EnumWirePart part; private final int hash; @@ -38,22 +39,22 @@ public String toString() { return "(" + pos.getX() + ", " + pos.getY() + ", " + pos.getZ() + ", " + part + ")"; } - public WireNode offset(EnumFacing face) { - int nx = (part.x == AxisDirection.POSITIVE ? 1 : 0) + face.getFrontOffsetX(); - int ny = (part.y == AxisDirection.POSITIVE ? 1 : 0) + face.getFrontOffsetY(); - int nz = (part.z == AxisDirection.POSITIVE ? 1 : 0) + face.getFrontOffsetZ(); + public WireNode offset(Direction face) { + int nx = (part.x == AxisDirection.POSITIVE ? 1 : 0) + face.getStepX(); + int ny = (part.y == AxisDirection.POSITIVE ? 1 : 0) + face.getStepY(); + int nz = (part.z == AxisDirection.POSITIVE ? 1 : 0) + face.getStepZ(); EnumWirePart nPart = EnumWirePart.get(nx, ny, nz); if (nx < 0 || ny < 0 || nz < 0 || nx > 1 || ny > 1 || nz > 1) { - return new WireNode(pos.offset(face), nPart); + return new WireNode(pos.relative(face), nPart); } else { return new WireNode(pos, nPart); } } - public Map getAllPossibleConnections() { - Map map = new EnumMap<>(EnumFacing.class); + public Map getAllPossibleConnections() { + Map map = new EnumMap<>(Direction.class); - for (EnumFacing face : EnumFacing.VALUES) { + for (Direction face : Direction.values()) { map.put(face, offset(face)); } return map; diff --git a/api/buildcraft/api/transport/package-info.java b/api/buildcraft/api/transport/package-info.java index b9cd4de..777f84f 100644 --- a/api/buildcraft/api/transport/package-info.java +++ b/api/buildcraft/api/transport/package-info.java @@ -2,7 +2,6 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "5.0", owner = "buildcraftapi_core", provides = "buildcraftapi_transport") +//@API(apiVersion = "5.0", owner = "buildcraftapi_core", provides = "buildcraftapi_transport") package buildcraft.api.transport; -import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/transport/pipe/EnumPipeColourType.java b/api/buildcraft/api/transport/pipe/EnumPipeColourType.java index ccf2a9b..3a6b3f2 100644 --- a/api/buildcraft/api/transport/pipe/EnumPipeColourType.java +++ b/api/buildcraft/api/transport/pipe/EnumPipeColourType.java @@ -1,6 +1,7 @@ package buildcraft.api.transport.pipe; -public enum EnumPipeColourType { +public enum EnumPipeColourType +{ TRANSLUCENT, BORDER_OUTER, BORDER_INNER, diff --git a/api/buildcraft/api/transport/pipe/ICustomPipeConnection.java b/api/buildcraft/api/transport/pipe/ICustomPipeConnection.java index d4ca9ab..ab52ddc 100644 --- a/api/buildcraft/api/transport/pipe/ICustomPipeConnection.java +++ b/api/buildcraft/api/transport/pipe/ICustomPipeConnection.java @@ -1,13 +1,14 @@ package buildcraft.api.transport.pipe; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; -public interface ICustomPipeConnection { +public interface ICustomPipeConnection +{ /** @return How long the connecting pipe should extend for, in addition to its normal 4/16f connection. Values less * than or equal to -4 / 16.0f indicate that the pipe will not connect at all, and will render * as it it was not connected. */ - float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state); + float getExtension(Level world, BlockPos pos, Direction face, BlockState state); } diff --git a/api/buildcraft/api/transport/pipe/IFlowFluid.java b/api/buildcraft/api/transport/pipe/IFlowFluid.java index 259736a..55438d0 100644 --- a/api/buildcraft/api/transport/pipe/IFlowFluid.java +++ b/api/buildcraft/api/transport/pipe/IFlowFluid.java @@ -1,66 +1,83 @@ package buildcraft.api.transport.pipe; -import javax.annotation.Nullable; - -import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; - -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.IFluidHandler; - import buildcraft.api.core.IFluidFilter; import buildcraft.api.core.IFluidHandlerAdv; import buildcraft.api.transport.pluggable.PipePluggable; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.capability.IFluidHandler; -public interface IFlowFluid { - /** @deprecated use the version below with a simulate paramater. */ +import javax.annotation.Nullable; + +public interface IFlowFluid +{ + /** + * @deprecated use the version below with a simulate paramater. + */ @Nullable @Deprecated - default FluidStack tryExtractFluid(int millibuckets, EnumFacing from, FluidStack filter) { - return tryExtractFluid(millibuckets, from, filter, false); + default FluidStack tryExtractFluid(int millibuckets, Direction from, FluidStack filter) + { +// return tryExtractFluid(millibuckets, from, filter, false); + return tryExtractFluid(millibuckets, from, filter, IFluidHandler.FluidAction.EXECUTE); } - /** @param millibuckets + /** + * @param millibuckets * @param from - * @param filter The fluidstack that the extracted fluid must match, or null for any fluid. - * @return The fluidstack extracted and inserted into the pipe. */ + * @param filter The fluidstack that the extracted fluid must match, or null for any fluid. + * @return The fluidstack extracted and inserted into the pipe. + */ @Nullable - FluidStack tryExtractFluid(int millibuckets, EnumFacing from, FluidStack filter, boolean simulate); +// FluidStack tryExtractFluid(int millibuckets, Direction from, FluidStack filter, boolean simulate); + FluidStack tryExtractFluid(int millibuckets, Direction from, FluidStack filter, IFluidHandler.FluidAction action); - /** @deprecated use the version below with a simulate paramater. */ + /** + * @deprecated use the version below with a simulate paramater. + */ @Deprecated - default ActionResult tryExtractFluidAdv(int millibuckets, EnumFacing from, IFluidFilter filter) { - return tryExtractFluidAdv(millibuckets, from, filter, false); + default InteractionResultHolder tryExtractFluidAdv(int millibuckets, Direction from, IFluidFilter filter) + { +// return tryExtractFluidAdv(millibuckets, from, filter, false); + return tryExtractFluidAdv(millibuckets, from, filter, IFluidHandler.FluidAction.EXECUTE); } - /** Advanced version of {@link #tryExtractFluid(int, EnumFacing, FluidStack, boolean)}. Note that this only works for + /** + * Advanced version of {@link #tryExtractFluid(int, Direction, FluidStack, boolean)}. Note that this only works for * instances of {@link IFluidHandler} that ALSO extends {@link IFluidHandlerAdv} - * + * * @param millibuckets * @param from - * @param filter A filter to try and match fluids. - * @return The fluidstack extracted and inserted into the pipe. If {@link ActionResult#getType()} equals - * {@link EnumActionResult#PASS} then it means that the {@link IFluidHandler} didn't implement - * {@link IFluidHandlerAdv} and you should call the basic version, if you can. */ - ActionResult tryExtractFluidAdv(int millibuckets, EnumFacing from, IFluidFilter filter, boolean simulate); + * @param filter A filter to try and match fluids. + * @return The fluidstack extracted and inserted into the pipe. If {@link InteractionResultHolder#getType()} equals + * {@link InteractionResult#PASS} then it means that the {@link IFluidHandler} didn't implement + * {@link IFluidHandlerAdv} and you should call the basic version, if you can. + */ +// InteractionResultHolder tryExtractFluidAdv(int millibuckets, Direction from, IFluidFilter filter, boolean simulate); + InteractionResultHolder tryExtractFluidAdv(int millibuckets, Direction from, IFluidFilter filter, IFluidHandler.FluidAction action); - /** Attempts to insert a fluid directly into the pipe. Note that this will fail if the pipe currently contains a + /** + * Attempts to insert a fluid directly into the pipe. Note that this will fail if the pipe currently contains a * different fluid type. - * + * * @param from The side that the fluid should *not* go in, or null if the fluid may flow in any direction. - * @return The amount of fluid that was accepted, or 0 if no fluid was accepted. */ - int insertFluidsForce(FluidStack fluid, @Nullable EnumFacing from, boolean simulate); + * @return The amount of fluid that was accepted, or 0 if no fluid was accepted. + */ + int insertFluidsForce(FluidStack fluid, @Nullable Direction from, boolean simulate); - /** Tries to extract fluids directly from the pipe. NOTE: This is intended for {@link PipeBehaviour} and + /** + * Tries to extract fluids directly from the pipe. NOTE: This is intended for {@link PipeBehaviour} and * {@link PipePluggable} implementors ONLY! This will result in very buggy behaviour if external tiles try to use * this! - * - * @param min The minimum amount of fluid to extract. If less than this amount is in the given center then nothing - * will be extracted. - * @param section The section to extract from. Null means the center. + * + * @param min The minimum amount of fluid to extract. If less than this amount is in the given center then nothing + * will be extracted. + * @param section The section to extract from. Null means the center. * @param simulate - * @return */ + * @return + */ @Nullable - FluidStack extractFluidsForce(int min, int max, @Nullable EnumFacing section, boolean simulate); + FluidStack extractFluidsForce(int min, int max, @Nullable Direction section, boolean simulate); } diff --git a/api/buildcraft/api/transport/pipe/IFlowItems.java b/api/buildcraft/api/transport/pipe/IFlowItems.java index bdedd38..239d2ea 100644 --- a/api/buildcraft/api/transport/pipe/IFlowItems.java +++ b/api/buildcraft/api/transport/pipe/IFlowItems.java @@ -1,20 +1,19 @@ package buildcraft.api.transport.pipe; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; - import buildcraft.api.core.IStackFilter; import buildcraft.api.transport.IInjectable; +import net.minecraft.core.Direction; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.ItemStack; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; public interface IFlowItems extends IInjectable { /** @deprecated Use the version below with a simulate paramater. */ @Deprecated - default int tryExtractItems(int count, EnumFacing from, @Nullable EnumDyeColor colour, IStackFilter filter) { + default int tryExtractItems(int count, Direction from, @Nullable DyeColor colour, IStackFilter filter) { return tryExtractItems(count, from, colour, filter, false); } @@ -26,7 +25,7 @@ default int tryExtractItems(int count, EnumFacing from, @Nullable EnumDyeColor c * @param filter The filter to determine what can be extracted. * @param simulate If true then only simulate the extraction. * @return The number of items extracted. */ - int tryExtractItems(int count, EnumFacing from, @Nullable EnumDyeColor colour, IStackFilter filter, boolean simulate); + int tryExtractItems(int count, Direction from, @Nullable DyeColor colour, IStackFilter filter, boolean simulate); /** Inserts an item directly into the centre of this pipe, going in the given direction. This should ONLY be called * from an instance of {@link PipeBehaviour}, as otherwise it can lead to problems. (For example crashing if a pipe @@ -37,9 +36,9 @@ default int tryExtractItems(int count, EnumFacing from, @Nullable EnumDyeColor c * @param colour The colour of the item to be added to the pipe, or null for no colour. * @param speed The speed of the item to be added (in blocks per tick) or {@code <=0} if a default should be * used. */ - void insertItemsForce(@Nonnull ItemStack stack, EnumFacing from, @Nullable EnumDyeColor colour, double speed); + void insertItemsForce(@Nonnull ItemStack stack, Direction from, @Nullable DyeColor colour, double speed); /** Sends a phantom (fake) item from the given facing, to the other facing. If from is null then it will start at * the center, or if to is null then it will end at the center. */ - void sendPhantomItem(@Nonnull ItemStack stack, @Nullable EnumFacing from, @Nullable EnumFacing to, @Nullable EnumDyeColor colour); + void sendPhantomItem(@Nonnull ItemStack stack, @Nullable Direction from, @Nullable Direction to, @Nullable DyeColor colour); } diff --git a/api/buildcraft/api/transport/pipe/IFlowPower.java b/api/buildcraft/api/transport/pipe/IFlowPower.java index 051d0ad..a425108 100644 --- a/api/buildcraft/api/transport/pipe/IFlowPower.java +++ b/api/buildcraft/api/transport/pipe/IFlowPower.java @@ -1,8 +1,7 @@ package buildcraft.api.transport.pipe; -import net.minecraft.util.EnumFacing; - import buildcraft.api.mj.IMjPassiveProvider; +import net.minecraft.core.Direction; public interface IFlowPower { /** Makes this pipe reconfigure itself, possibly due to the addition of new modules. */ @@ -13,5 +12,5 @@ public interface IFlowPower { * @param maxPower The Maximum amount of power that can be extracted. * @param from The side (of this pipe) to take power from. * @return The amount of power extracted. */ - long tryExtractPower(long maxPower, EnumFacing from); + long tryExtractPower(long maxPower, Direction from); } diff --git a/api/buildcraft/api/transport/pipe/IItemPipe.java b/api/buildcraft/api/transport/pipe/IItemPipe.java index 1d2d377..bbded7b 100644 --- a/api/buildcraft/api/transport/pipe/IItemPipe.java +++ b/api/buildcraft/api/transport/pipe/IItemPipe.java @@ -1,7 +1,16 @@ package buildcraft.api.transport.pipe; +import net.minecraft.world.item.DyeColor; + +import javax.annotation.Nullable; + /** To be implemented by the real item pipe in Transport mod, but leaves knowledge for classes that do not have direct * dependency on transport. */ -public interface IItemPipe { +public interface IItemPipe +{ PipeDefinition getDefinition(); + + // Calen + @Nullable + DyeColor getColour(); } diff --git a/api/buildcraft/api/transport/pipe/IPipe.java b/api/buildcraft/api/transport/pipe/IPipe.java index 8f3d51e..a6ebdf4 100644 --- a/api/buildcraft/api/transport/pipe/IPipe.java +++ b/api/buildcraft/api/transport/pipe/IPipe.java @@ -1,9 +1,8 @@ package buildcraft.api.transport.pipe; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - +import net.minecraft.core.Direction; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.common.capabilities.ICapabilityProvider; public interface IPipe extends ICapabilityProvider { @@ -15,19 +14,19 @@ public interface IPipe extends ICapabilityProvider { PipeFlow getFlow(); - EnumDyeColor getColour(); + DyeColor getColour(); - void setColour(EnumDyeColor colour); + void setColour(DyeColor colour); void markForUpdate(); - TileEntity getConnectedTile(EnumFacing side); + BlockEntity getConnectedTile(Direction side); - IPipe getConnectedPipe(EnumFacing side); + IPipe getConnectedPipe(Direction side); - boolean isConnected(EnumFacing side); + boolean isConnected(Direction side); - ConnectedType getConnectedType(EnumFacing side); + ConnectedType getConnectedType(Direction side); enum ConnectedType { TILE, diff --git a/api/buildcraft/api/transport/pipe/IPipeBehaviourBaker.java b/api/buildcraft/api/transport/pipe/IPipeBehaviourBaker.java index f5c50cb..c4a4a46 100644 --- a/api/buildcraft/api/transport/pipe/IPipeBehaviourBaker.java +++ b/api/buildcraft/api/transport/pipe/IPipeBehaviourBaker.java @@ -1,9 +1,9 @@ package buildcraft.api.transport.pipe; -import java.util.List; - import net.minecraft.client.renderer.block.model.BakedQuad; +import java.util.List; + public interface IPipeBehaviourBaker { List bake(B behaviour); } diff --git a/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java b/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java index 5b00179..a8e1a45 100644 --- a/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java +++ b/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java @@ -1,12 +1,13 @@ package buildcraft.api.transport.pipe; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraft.client.renderer.BufferBuilder; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public interface IPipeBehaviourRenderer { - void render(B behaviour, double x, double y, double z, float partialTicks, BufferBuilder bb); +// void render(B behaviour, double x, double y, double z, float partialTicks, BufferBuilder bb); +// public void render(B gate, float partialTicks, PoseStack poseStack, MultiBufferSource bufferSource, int combinedLight, int combinedOverlay); + public void render(B gate, float partialTicks, PoseStack poseStack, VertexConsumer vertexConsumer, int combinedLight, int combinedOverlay); } diff --git a/api/buildcraft/api/transport/pipe/IPipeConnection.java b/api/buildcraft/api/transport/pipe/IPipeConnection.java index 55a5142..2031feb 100644 --- a/api/buildcraft/api/transport/pipe/IPipeConnection.java +++ b/api/buildcraft/api/transport/pipe/IPipeConnection.java @@ -4,7 +4,7 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.transport.pipe; -import net.minecraft.util.EnumFacing; +import net.minecraft.core.Direction; @Deprecated // TODO: Test to see if this is necessary! (Or perhaps make it a capability) @@ -22,5 +22,5 @@ enum ConnectOverride { * @param type * @param with * @return CONNECT to force a connection, DISCONNECT to force no connection, and DEFAULT to let the pipe decide. */ - ConnectOverride overridePipeConnection(Object/*IPipeTile.PipeType*/ type, EnumFacing with); + ConnectOverride overridePipeConnection(Object/*IPipeTile.PipeType*/ type, Direction with); } diff --git a/api/buildcraft/api/transport/pipe/IPipeExtensionManager.java b/api/buildcraft/api/transport/pipe/IPipeExtensionManager.java index eaf6628..51bbc3f 100644 --- a/api/buildcraft/api/transport/pipe/IPipeExtensionManager.java +++ b/api/buildcraft/api/transport/pipe/IPipeExtensionManager.java @@ -4,19 +4,18 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.transport.pipe; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - import buildcraft.api.transport.IStripesActivator; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; public interface IPipeExtensionManager { /** - * Requests an extension by one block from a IStripesActivator (usually a stripes transport pipe) with the pipe supplied + * Requests an extension by one core from a IStripesActivator (usually a stripes transport pipe) with the pipe supplied * by the stack by moving the stripes pipe to the front and placing the new transport pipe behind. - * If the pipe is a registered retraction pipe (per default only the void transport pipe is - register one with {@link #registerRetractionPipe(PipeDefinition)}) it retracts the pipeline instead by moving the stripes pipe one block + * If the pipe is a registered retraction pipe (per default only the void transport pipe is - register one with {@link #registerRetractionPipe(PipeDefinition)}) it retracts the pipeline instead by moving the stripes pipe one core * in the opposite direction, replacing the previous transport pipe. * * @param world the world @@ -26,7 +25,7 @@ public interface IPipeExtensionManager { * @param stack the pipe stack to use (Note: only uses one item and sends the rest back) * @return true on success, false otherwise */ - boolean requestPipeExtension(World world, BlockPos pos, EnumFacing dir, IStripesActivator stripes, ItemStack stack); + boolean requestPipeExtension(Level world, BlockPos pos, Direction dir, IStripesActivator stripes, ItemStack stack); /** * Registers a pipe as a retraction trigger for pipe extension requests diff --git a/api/buildcraft/api/transport/pipe/IPipeFlowBaker.java b/api/buildcraft/api/transport/pipe/IPipeFlowBaker.java index 97bcf98..c23afc2 100644 --- a/api/buildcraft/api/transport/pipe/IPipeFlowBaker.java +++ b/api/buildcraft/api/transport/pipe/IPipeFlowBaker.java @@ -1,9 +1,9 @@ package buildcraft.api.transport.pipe; -import java.util.List; - import net.minecraft.client.renderer.block.model.BakedQuad; +import java.util.List; + public interface IPipeFlowBaker { List bake(F flow); } diff --git a/api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java b/api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java index 7ce7636..a9646d7 100644 --- a/api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java +++ b/api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java @@ -1,6 +1,7 @@ package buildcraft.api.transport.pipe; -import net.minecraft.client.renderer.BufferBuilder; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; public interface IPipeFlowRenderer { /** @param flow The flow to render @@ -8,5 +9,6 @@ public interface IPipeFlowRenderer { * @param y * @param z * @param bufferBuilder The (optional) vertex buffer that you can render into. Note that you can still do GL stuff. */ - void render(F flow, double x, double y, double z, float partialTicks, BufferBuilder bufferBuilder); +// void render(F flow, double x, double y, double z, float partialTicks, BufferBuilder bufferBuilder); + void render(F flow, float partialTicks, PoseStack poseStack, VertexConsumer vertexConsumer, int combinedLight, int combinedOverlay); } diff --git a/api/buildcraft/api/transport/pipe/IPipeHolder.java b/api/buildcraft/api/transport/pipe/IPipeHolder.java index ef00690..dbb2374 100644 --- a/api/buildcraft/api/transport/pipe/IPipeHolder.java +++ b/api/buildcraft/api/transport/pipe/IPipeHolder.java @@ -1,112 +1,156 @@ package buildcraft.api.transport.pipe; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.mojang.authlib.GameProfile; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.common.capabilities.Capability; - import buildcraft.api.statements.containers.IRedstoneStatementContainer; import buildcraft.api.transport.IWireManager; import buildcraft.api.transport.pluggable.PipePluggable; +import buildcraft.lib.net.MessageUpdateTile; +import com.mojang.authlib.GameProfile; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.common.capabilities.Capability; -/** Designates a tile that can contain a pipe, up to 6 sided pluggables. */ -public interface IPipeHolder extends IRedstoneStatementContainer { - World getPipeWorld(); +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Designates a tile that can contain a pipe, up to 6 sided pluggables. + */ +public interface IPipeHolder extends IRedstoneStatementContainer, MenuProvider +{ + Level getPipeWorld(); BlockPos getPipePos(); - TileEntity getPipeTile(); + BlockEntity getPipeTile(); IPipe getPipe(); - /** @return true if the player should be able to interact with the pipe holder in GUI form. Implementors should - * generally check to ensure they are still present in-world. */ - boolean canPlayerInteract(EntityPlayer player); + /** + * @return true if the player should be able to interact with the pipe holder in GUI form. Implementors should + * generally check to ensure they are still present in-world. + */ + boolean canPlayerInteract(Player player); @Nullable - PipePluggable getPluggable(EnumFacing side); + PipePluggable getPluggable(Direction side); @Nullable - TileEntity getNeighbourTile(EnumFacing side); + BlockEntity getNeighbourTile(Direction side); @Nullable - IPipe getNeighbourPipe(EnumFacing side); + IPipe getNeighbourPipe(Direction side); - /** Gets the given capability going outwards from the pipe. This will test the - * {@link PipePluggable#getInternalCapability(Capability)} first, and the look at the neighbouring tile. */ + /** + * Gets the given capability going outwards from the pipe. This will test the + * {@link PipePluggable#getInternalCapability(Capability)} first, and the look at the neighbouring tile. + */ @Nullable - T getCapabilityFromPipe(EnumFacing side, @Nonnull Capability capability); + T getCapabilityFromPipe(Direction side, @Nonnull Capability capability); + +// // Calen test for power flow circle +// @Nullable +// default T getCapabilityFromPipe(Direction side, @Nonnull Capability capability, LinkedList trackList) +// { +// if (trackList.contains(this)) +// { +// return null; +// } +// else +// { +// trackList.push(this); +// T cap = getCapabilityFromPipe(side, capability); +// trackList.pop(); +// return cap; +// } +// } IWireManager getWireManager(); GameProfile getOwner(); - /** @return True if at least 1 handler received this event, false if not. */ + /** + * @return True if at least 1 handler received this event, false if not. + */ boolean fireEvent(PipeEvent event); void scheduleRenderUpdate(); - /** @param parts The parts that want to send a network update. */ + /** + * @param parts The parts that want to send a network update. + */ void scheduleNetworkUpdate(PipeMessageReceiver... parts); - /** Schedules a GUI network update, that is only the players who currently have a pipe element open in a GUI will be + /** + * Schedules a GUI network update, that is only the players who currently have a pipe element open in a GUI will be * updated. - * - * @param parts The parts that want to send a network update. */ + * + * @param parts The parts that want to send a network update. + */ void scheduleNetworkGuiUpdate(PipeMessageReceiver... parts); - /** Sends a custom message from a pluggable or pipe centre to the server/client (depending on which side this is - * currently on). */ + /** + * Sends a custom message from a pluggable or pipe centre to the server/client (depending on which side this is + * currently on). + */ void sendMessage(PipeMessageReceiver to, IWriter writer); void sendGuiMessage(PipeMessageReceiver to, IWriter writer); - /** Called on the server whenever a gui container object is opened. */ - void onPlayerOpen(EntityPlayer player); + /** + * Called on the server whenever a gui container object is opened. + */ + void onPlayerOpen(Player player); + + // Calen: only for Server preparing for opening Gate GUI + MessageUpdateTile onServerPlayerOpenNoSend(Player player); - /** Called on the server whenever a gui container object is closed. */ - void onPlayerClose(EntityPlayer player); + /** + * Called on the server whenever a gui container object is closed. + */ + void onPlayerClose(Player player); - enum PipeMessageReceiver { + enum PipeMessageReceiver + { BEHAVIOUR(null), FLOW(null), - PLUGGABLE_DOWN(EnumFacing.DOWN), - PLUGGABLE_UP(EnumFacing.UP), - PLUGGABLE_NORTH(EnumFacing.NORTH), - PLUGGABLE_SOUTH(EnumFacing.SOUTH), - PLUGGABLE_WEST(EnumFacing.WEST), - PLUGGABLE_EAST(EnumFacing.EAST), + PLUGGABLE_DOWN(Direction.DOWN), + PLUGGABLE_UP(Direction.UP), + PLUGGABLE_NORTH(Direction.NORTH), + PLUGGABLE_SOUTH(Direction.SOUTH), + PLUGGABLE_WEST(Direction.WEST), + PLUGGABLE_EAST(Direction.EAST), WIRES(null); // Wires are updated differently (they never use this API) public static final PipeMessageReceiver[] VALUES = values(); public static final PipeMessageReceiver[] PLUGGABLES = new PipeMessageReceiver[6]; - static { - for (PipeMessageReceiver type : VALUES) { - if (type.face != null) { + static + { + for (PipeMessageReceiver type : VALUES) + { + if (type.face != null) + { PLUGGABLES[type.face.ordinal()] = type; } } } - public final EnumFacing face; + public final Direction face; - PipeMessageReceiver(EnumFacing face) { + PipeMessageReceiver(Direction face) + { this.face = face; } } - interface IWriter { - void write(PacketBuffer buffer); + interface IWriter + { + void write(FriendlyByteBuf buffer); } } diff --git a/api/buildcraft/api/transport/pipe/IPipeRegistry.java b/api/buildcraft/api/transport/pipe/IPipeRegistry.java index e4ead26..94ce325 100644 --- a/api/buildcraft/api/transport/pipe/IPipeRegistry.java +++ b/api/buildcraft/api/transport/pipe/IPipeRegistry.java @@ -1,36 +1,46 @@ package buildcraft.api.transport.pipe; -import java.util.Map; -import java.util.function.Consumer; - -import javax.annotation.Nullable; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.DyeColor; +import net.minecraftforge.registries.RegistryObject; -import net.minecraft.item.Item; -import net.minecraft.util.ResourceLocation; +import java.util.Map; -public interface IPipeRegistry { +public interface IPipeRegistry +{ PipeDefinition getDefinition(ResourceLocation identifier); void registerPipe(PipeDefinition definition); - /** Maps the given {@link PipeDefinition} to an {@link IItemPipe}. This acts exactly akin to - * {@link Map#put(Object, Object)}. */ - void setItemForPipe(PipeDefinition definition, @Nullable IItemPipe item); + /** + * Maps the given {@link PipeDefinition} to an {@link IItemPipe}. This acts exactly akin to + * {@link Map#put(Object, Object)}. + */ +// void setItemForPipe(PipeDefinition definition, @Nullable IItemPipe item); +// void setItemForPipe(PipeDefinition definition, @Nullable RegistryObject item); + void setItemForPipe(PipeDefinition definition, Map> item); - IItemPipe getItemForPipe(PipeDefinition definition); + // Calen: reg different item object for different colour + // IItemPipe getItemForPipe(PipeDefinition definition); + IItemPipe getItemForPipe(PipeDefinition definition, DyeColor colour); - /** Creates an {@link IItemPipe} for the given {@link PipeDefinition}. If the {@link PipeDefinition} has been + /** + * Creates an {@link IItemPipe} for the given {@link PipeDefinition}. If the {@link PipeDefinition} has been * registered with {@link #registerPipe(PipeDefinition)} then it will also be registered with * {@link #setItemForPipe(PipeDefinition, IItemPipe)}. The returned item will be automatically registered with - * forge. */ - IItemPipe createItemForPipe(PipeDefinition definition); - - /** Identical to {@link #createItemForPipe(PipeDefinition)}, but doesn't require registering tags with buildcraft - * lib in order to register. - * - * @param postCreate A function to call in order to setup the {@link Item#setRegistryName(ResourceLocation)} and - * {@link Item#setUnlocalizedName(String)}. */ - IItemPipe createUnnamedItemForPipe(PipeDefinition definition, Consumer postCreate); + * forge. + */ +// IItemPipe createItemForPipe(PipeDefinition definition); +// RegistryObject createItemForPipe(PipeDefinition definition); + Map> createItemForPipe(PipeDefinition definition); + + // Calen: never used in 1.12.2 +// /** Identical to {@link #createItemForPipe(PipeDefinition)}, but doesn't require registering tags with buildcraftcore +// * lib in order to register. +// * +// * @param postCreate A function to call in order to setup the {@link Item#setRegistryName(ResourceLocation)} and +// * {@link Item#setUnlocalizedName(String)}. */ +// IItemPipe createUnnamedItemForPipe(PipeDefinition definition, Consumer postCreate); Iterable getAllRegisteredPipes(); } diff --git a/api/buildcraft/api/transport/pipe/PipeApi.java b/api/buildcraft/api/transport/pipe/PipeApi.java index cc9997c..629378c 100644 --- a/api/buildcraft/api/transport/pipe/PipeApi.java +++ b/api/buildcraft/api/transport/pipe/PipeApi.java @@ -1,21 +1,26 @@ package buildcraft.api.transport.pipe; -import java.util.IdentityHashMap; -import java.util.Map; - -import javax.annotation.Nonnull; - -import net.minecraftforge.common.capabilities.Capability; - -import buildcraft.api.core.CapabilitiesHelper; -import buildcraft.api.mj.MjAPI; +import buildcraft.api.mj.*; import buildcraft.api.transport.IInjectable; import buildcraft.api.transport.IStripesRegistry; import buildcraft.api.transport.pluggable.IPluggableRegistry; import buildcraft.api.transport.pluggable.PipePluggable; +import buildcraft.lib.BCLib; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.CapabilityToken; +import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; + +import javax.annotation.Nonnull; +import java.util.IdentityHashMap; +import java.util.Map; /** The central holding class for all pipe related registers and methods. */ -public final class PipeApi { +@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = BCLib.MODID) // Calen add for reg caps +public final class PipeApi +{ public static IPipeRegistry pipeRegistry; public static IPluggableRegistry pluggableRegistry; public static IStripesRegistry stripeRegistry; @@ -37,16 +42,16 @@ public final class PipeApi { public static final Map powerTransferData = new IdentityHashMap<>(); @Nonnull - public static final Capability CAP_PIPE_HOLDER; + public static final Capability CAP_PIPE_HOLDER = CapabilityManager.get(new CapabilityToken<>(){}); @Nonnull - public static final Capability CAP_PIPE; + public static final Capability CAP_PIPE = CapabilityManager.get(new CapabilityToken<>(){}); @Nonnull - public static final Capability CAP_PLUG; + public static final Capability CAP_PLUG = CapabilityManager.get(new CapabilityToken<>(){}); @Nonnull - public static final Capability CAP_INJECTABLE; + public static final Capability CAP_INJECTABLE = CapabilityManager.get(new CapabilityToken<>(){}); public static FluidTransferInfo getFluidTransferInfo(PipeDefinition def) { FluidTransferInfo info = fluidTransferData.get(def); @@ -123,10 +128,20 @@ public PowerTransferInfo(long transferPerTick, long lossPerTick, long resistance // Internals - static { - CAP_PIPE = CapabilitiesHelper.registerCapability(IPipe.class); - CAP_PLUG = CapabilitiesHelper.registerCapability(PipePluggable.class); - CAP_PIPE_HOLDER = CapabilitiesHelper.registerCapability(IPipeHolder.class); - CAP_INJECTABLE = CapabilitiesHelper.registerCapability(IInjectable.class); +// static { +// CAP_PIPE = CapabilitiesHelper.registerCapability(IPipe.class); +// CAP_PLUG = CapabilitiesHelper.registerCapability(PipePluggable.class); +// CAP_PIPE_HOLDER = CapabilitiesHelper.registerCapability(IPipeHolder.class); +// CAP_INJECTABLE = CapabilitiesHelper.registerCapability(IInjectable.class); +// } + + // Calen + @SubscribeEvent + public static void registerCapability(RegisterCapabilitiesEvent event) + { + event.register(IPipe.class); + event.register(PipePluggable.class); + event.register(IPipeHolder.class); + event.register(IInjectable.class); } } diff --git a/api/buildcraft/api/transport/pipe/PipeApiClient.java b/api/buildcraft/api/transport/pipe/PipeApiClient.java index ebcd9e6..c6ac351 100644 --- a/api/buildcraft/api/transport/pipe/PipeApiClient.java +++ b/api/buildcraft/api/transport/pipe/PipeApiClient.java @@ -1,14 +1,13 @@ package buildcraft.api.transport.pipe; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - import buildcraft.api.transport.pluggable.IPlugDynamicRenderer; import buildcraft.api.transport.pluggable.IPluggableStaticBaker; import buildcraft.api.transport.pluggable.PipePluggable; import buildcraft.api.transport.pluggable.PluggableModelKey; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public enum PipeApiClient { INSTANCE; diff --git a/api/buildcraft/api/transport/pipe/PipeBehaviour.java b/api/buildcraft/api/transport/pipe/PipeBehaviour.java index e4622bc..05c6f48 100644 --- a/api/buildcraft/api/transport/pipe/PipeBehaviour.java +++ b/api/buildcraft/api/transport/pipe/PipeBehaviour.java @@ -1,25 +1,24 @@ package buildcraft.api.transport.pipe; -import java.io.IOException; - -import javax.annotation.Nonnull; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.NonNullList; -import net.minecraft.util.math.RayTraceResult; - +import buildcraft.api.core.EnumPipePart; +import net.minecraft.core.Direction; +import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.phys.HitResult; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; -import buildcraft.api.core.EnumPipePart; +import javax.annotation.Nonnull; +import java.io.IOException; public abstract class PipeBehaviour implements ICapabilityProvider { public final IPipe pipe; @@ -28,47 +27,48 @@ public PipeBehaviour(IPipe pipe) { this.pipe = pipe; } - public PipeBehaviour(IPipe pipe, NBTTagCompound nbt) { + public PipeBehaviour(IPipe pipe, CompoundTag nbt) { this.pipe = pipe; } - public NBTTagCompound writeToNbt() { - NBTTagCompound nbt = new NBTTagCompound(); + public CompoundTag writeToNbt() { + CompoundTag nbt = new CompoundTag(); return nbt; } - public void writePayload(PacketBuffer buffer, Side side) {} + public void writePayload(FriendlyByteBuf buffer, Dist side) {} - public void readPayload(PacketBuffer buffer, Side side, MessageContext ctx) throws IOException {} +// public void readPayload(FriendlyByteBuf buffer, Dist side, MessageContext ctx) throws IOException {} + public void readPayload(FriendlyByteBuf buffer, NetworkDirection side, NetworkEvent.Context ctx) throws IOException{} - /** @deprecated Replaced by {@link #getTextureData(EnumFacing)}. */ + /** @deprecated Replaced by {@link #getTextureData(Direction)}. */ @Deprecated - public int getTextureIndex(EnumFacing face) { + public int getTextureIndex(Direction face) { return 0; } - public PipeFaceTex getTextureData(EnumFacing face) { + public PipeFaceTex getTextureData(Direction face) { return PipeFaceTex.get(getTextureIndex(face)); } // Event handling - public boolean canConnect(EnumFacing face, PipeBehaviour other) { + public boolean canConnect(Direction face, PipeBehaviour other) { return true; } - public boolean canConnect(EnumFacing face, TileEntity oTile) { + public boolean canConnect(Direction face, BlockEntity oTile) { return true; } /** Used to force a connection to a given tile, even if the {@link PipeFlow} wouldn't normally connect to it. */ - public boolean shouldForceConnection(EnumFacing face, TileEntity oTile) { + public boolean shouldForceConnection(Direction face, BlockEntity oTile) { return false; } - public boolean onPipeActivate(EntityPlayer player, RayTraceResult trace, float hitX, float hitY, float hitZ, - EnumPipePart part) { + public boolean onPipeActivate(Player player, HitResult trace, float hitX, float hitY, float hitZ, + EnumPipePart part) { return false; } @@ -76,14 +76,17 @@ public void onEntityCollide(Entity entity) {} public void onTick() {} - @Override - public boolean hasCapability(@Nonnull Capability capability, EnumFacing facing) { - return getCapability(capability, facing) != null; - } + // Calen: getCapability(...).isPresent() +// @Override +// public boolean hasCapability(@Nonnull Capability capability, Direction facing) +// { +// return getCapability(capability, facing) != null; +// } + @Nonnull @Override - public T getCapability(@Nonnull Capability capability, EnumFacing facing) { - return null; + public LazyOptional getCapability(@Nonnull Capability capability, Direction facing) { + return LazyOptional.empty(); } public void addDrops(NonNullList toDrop, int fortune) {} diff --git a/api/buildcraft/api/transport/pipe/PipeConnectionAPI.java b/api/buildcraft/api/transport/pipe/PipeConnectionAPI.java index 9872034..709eb12 100644 --- a/api/buildcraft/api/transport/pipe/PipeConnectionAPI.java +++ b/api/buildcraft/api/transport/pipe/PipeConnectionAPI.java @@ -1,34 +1,33 @@ package buildcraft.api.transport.pipe; -import java.util.Map; - import com.google.common.collect.Maps; +import net.minecraft.world.level.block.Block; -import net.minecraft.block.Block; +import java.util.Map; -/** Use this class to register blocks with custom block sizes so that pipes can connect to them properly. Note that you - * do not need to register a custom pipe connection if your block implements ICustomPipeConnection. The registered +/** Use this class to register blocks with custom core sizes so that pipes can connect to them properly. Note that you + * do not need to register a custom pipe connection if your core implements ICustomPipeConnection. The registered * version does not override your own implementation. */ public final class PipeConnectionAPI { private static final Map connections = Maps.newHashMap(); private static final ICustomPipeConnection NOTHING = (world, pos, face, state) -> 0; - /** Register a block with a custom connection. Useful if you don't own the block class or are adding it for some-one + /** Register a core with a custom connection. Useful if you don't own the core class or are adding it for some-one * else. * - * @param block The block instance + * @param block The core instance * @param connection The connection instance */ public static void registerConnection(Block block, ICustomPipeConnection connection) { connections.put(block, connection); } - /** Ensures that a particular block will always have the default connection, no matter what the bounding box the the - * block is. */ + /** Ensures that a particular core will always have the default connection, no matter what the bounding box the the + * core is. */ public static void registerConnectionAsNothing(Block block) { connections.put(block, NOTHING); } - /** Gets the current custom connection that the block uses. Will be null if nothing has been set. */ + /** Gets the current custom connection that the core uses. Will be null if nothing has been set. */ public static ICustomPipeConnection getCustomConnection(Block block) { if (block instanceof ICustomPipeConnection) { return (ICustomPipeConnection) block; diff --git a/api/buildcraft/api/transport/pipe/PipeDefinition.java b/api/buildcraft/api/transport/pipe/PipeDefinition.java index cfd3e68..8d93f30 100644 --- a/api/buildcraft/api/transport/pipe/PipeDefinition.java +++ b/api/buildcraft/api/transport/pipe/PipeDefinition.java @@ -1,15 +1,18 @@ package buildcraft.api.transport.pipe; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Rarity; +import net.minecraftforge.fml.ModContainer; +import net.minecraftforge.fml.ModLoadingContext; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ResourceLocation; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; - -public final class PipeDefinition { +public final class PipeDefinition +{ + public final Item.Properties properties; public final ResourceLocation identifier; public final IPipeCreator logicConstructor; public final IPipeLoader logicLoader; @@ -23,6 +26,7 @@ public final class PipeDefinition { private EnumPipeColourType colourType; public PipeDefinition(PipeDefinitionBuilder builder) { + this.properties = builder.properties; this.identifier = builder.identifier; this.textures = new String[builder.textureSuffixes.length]; for (int i = 0; i < textures.length; i++) { @@ -63,10 +67,16 @@ public interface IPipeCreator { @FunctionalInterface public interface IPipeLoader { - PipeBehaviour loadBehaviour(IPipe t, NBTTagCompound u); + PipeBehaviour loadBehaviour(IPipe t, CompoundTag u); } public static class PipeDefinitionBuilder { + public Item.Properties properties = new Item.Properties() + .rarity(Rarity.COMMON) + .durability(0) + .stacksTo(64) +// .tab(BCCreativeTab.BC_PIPES_TAB) + ; public ResourceLocation identifier; public String texturePrefix; public String[] textureSuffixes = { "" }; @@ -100,7 +110,7 @@ public PipeDefinitionBuilder idTex(String both) { } private static String getActiveModId() { - ModContainer mod = Loader.instance().activeModContainer(); + ModContainer mod = ModLoadingContext.get().getActiveContainer(); if (mod == null) { throw new IllegalStateException( "Cannot interact with PipeDefinition outside of an actively scoped mod!"); diff --git a/api/buildcraft/api/transport/pipe/PipeEvent.java b/api/buildcraft/api/transport/pipe/PipeEvent.java index 382e9c7..a874b30 100644 --- a/api/buildcraft/api/transport/pipe/PipeEvent.java +++ b/api/buildcraft/api/transport/pipe/PipeEvent.java @@ -3,7 +3,8 @@ /** The base class for all pipe events. Some event classes can be cancelled with {@link #cancel()}, however this will * only have an effect if {@link #canBeCancelled} is true. Refer to individual classes for information on if they can * be cancelled, and what cancelling the event does. */ -public abstract class PipeEvent { +public abstract class PipeEvent +{ public final boolean canBeCancelled; public final IPipeHolder holder; private boolean canceled = false; diff --git a/api/buildcraft/api/transport/pipe/PipeEventConnectionChange.java b/api/buildcraft/api/transport/pipe/PipeEventConnectionChange.java index fe529dd..01487ed 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventConnectionChange.java +++ b/api/buildcraft/api/transport/pipe/PipeEventConnectionChange.java @@ -1,14 +1,14 @@ package buildcraft.api.transport.pipe; -import net.minecraft.util.EnumFacing; +import net.minecraft.core.Direction; /** Fired whenever a connection change is picked up by an {@link IPipe}. This even doesn't include the new value - * (boolean isConnected) as it can be accessed via {@link IPipe#isConnected(EnumFacing)}. */ + * (boolean isConnected) as it can be accessed via {@link IPipe#isConnected(Direction)}. */ public class PipeEventConnectionChange extends PipeEvent { - public final EnumFacing direction; + public final Direction direction; - public PipeEventConnectionChange(IPipeHolder holder, EnumFacing direction) { + public PipeEventConnectionChange(IPipeHolder holder, Direction direction) { super(holder); this.direction = direction; } diff --git a/api/buildcraft/api/transport/pipe/PipeEventFluid.java b/api/buildcraft/api/transport/pipe/PipeEventFluid.java index e057122..008b59a 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventFluid.java +++ b/api/buildcraft/api/transport/pipe/PipeEventFluid.java @@ -1,15 +1,13 @@ package buildcraft.api.transport.pipe; +import net.minecraft.core.Direction; +import net.minecraftforge.fluids.FluidStack; + +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Collection; import java.util.EnumSet; -import javax.annotation.Nonnull; - -import net.minecraft.util.EnumFacing; - -import net.minecraftforge.fluids.FluidStack; - public abstract class PipeEventFluid extends PipeEvent { public final IFlowFluid flow; @@ -27,12 +25,12 @@ protected PipeEventFluid(boolean canBeCancelled, IPipeHolder holder, IFlowFluid } public static class TryInsert extends PipeEventFluid { - public final EnumFacing from; + public final Direction from; /** The incoming fluidstack. Currently changing this does nothing. */ @Nonnull public final FluidStack fluid; - public TryInsert(IPipeHolder holder, IFlowFluid flow, EnumFacing from, @Nonnull FluidStack fluid) { + public TryInsert(IPipeHolder holder, IFlowFluid flow, Direction from, @Nonnull FluidStack fluid) { super(true, holder, flow); this.from = from; this.fluid = fluid; @@ -48,14 +46,14 @@ public static class PreMoveToCentre extends PipeEventFluid { /** The maximum amount of fluid that the centre pipe could accept. */ public final int totalAcceptable; - /** Array of {@link EnumFacing#getIndex()} to the maximum amount of fluid that a given side can offer. DO NOT + /** Array of {@link Direction#getIndex()} to the maximum amount of fluid that a given side can offer. DO NOT * CHANGE THIS! */ public final int[] totalOffered; // Used for checking the state private final int[] totalOfferedCheck; - /** Array of {@link EnumFacing#getIndex()} to the amount of fluid that the given side will actually offer to the + /** Array of {@link Direction#getIndex()} to the amount of fluid that the given side will actually offer to the * centre. This should *never* be larger than */ public final int[] actuallyOffered; @@ -132,7 +130,7 @@ public static class SideCheck extends PipeEventFluid { /** The priorities of each side. Stored inversely to the values given, so a higher priority will have a lower * value than a lower priority. */ private final int[] priority = new int[6]; - private final EnumSet allowed = EnumSet.allOf(EnumFacing.class); + private final EnumSet allowed = EnumSet.allOf(Direction.class); public SideCheck(IPipeHolder holder, IFlowFluid flow, FluidStack fluid) { super(holder, flow); @@ -142,23 +140,23 @@ public SideCheck(IPipeHolder holder, IFlowFluid flow, FluidStack fluid) { /** Checks to see if a side if allowed. Note that this may return true even though a later handler might * disallow a side, so you should only use this to skip checking a side (for example a diamond pipe might not * check the filters for a specific side if its already been disallowed) */ - public boolean isAllowed(EnumFacing side) { + public boolean isAllowed(Direction side) { return allowed.contains(side); } /** Disallows the specific side(s) from being a destination for the item. If no sides are allowed, then the * fluid will stay in the current pipe section. */ - public void disallow(EnumFacing... sides) { - for (EnumFacing side : sides) { + public void disallow(Direction... sides) { + for (Direction side : sides) { allowed.remove(side); } } - public void disallowAll(Collection sides) { + public void disallowAll(Collection sides) { allowed.removeAll(sides); } - public void disallowAllExcept(EnumFacing side) { + public void disallowAllExcept(Direction side) { if (allowed.contains(side)) { allowed.clear(); allowed.add(side); @@ -167,7 +165,7 @@ public void disallowAllExcept(EnumFacing side) { } } - public void disallowAllExcept(EnumFacing... sides) { + public void disallowAllExcept(Direction... sides) { switch (sides.length) { case 0: { allowed.clear(); @@ -190,8 +188,8 @@ public void disallowAllExcept(EnumFacing... sides) { return; } default: { - EnumSet except = EnumSet.noneOf(EnumFacing.class); - for (EnumFacing face : sides) { + EnumSet except = EnumSet.noneOf(Direction.class); + for (Direction face : sides) { except.add(face); } this.allowed.retainAll(except); @@ -200,7 +198,7 @@ public void disallowAllExcept(EnumFacing... sides) { } } - public void disallowAllExcept(Collection sides) { + public void disallowAllExcept(Collection sides) { allowed.retainAll(sides); } @@ -208,25 +206,25 @@ public void disallowAll() { allowed.clear(); } - public void increasePriority(EnumFacing side) { + public void increasePriority(Direction side) { increasePriority(side, 1); } - public void increasePriority(EnumFacing side, int by) { + public void increasePriority(Direction side, int by) { priority[side.ordinal()] -= by; } - public void decreasePriority(EnumFacing side) { + public void decreasePriority(Direction side) { decreasePriority(side, 1); } - public void decreasePriority(EnumFacing side, int by) { + public void decreasePriority(Direction side, int by) { increasePriority(side, -by); } - public EnumSet getOrder() { + public EnumSet getOrder() { if (allowed.isEmpty()) { - return EnumSet.noneOf(EnumFacing.class); + return EnumSet.noneOf(Direction.class); } if (allowed.size() == 1) { return allowed; @@ -251,8 +249,8 @@ public EnumSet getOrder() { continue; } last = current; - EnumSet set = EnumSet.noneOf(EnumFacing.class); - for (EnumFacing face : EnumFacing.VALUES) { + EnumSet set = EnumSet.noneOf(Direction.class); + for (Direction face : Direction.values()) { if (allowed.contains(face)) { if (priority[face.ordinal()] == current) { set.add(face); @@ -263,7 +261,7 @@ public EnumSet getOrder() { return set; } } - return EnumSet.noneOf(EnumFacing.class); + return EnumSet.noneOf(Direction.class); } } } diff --git a/api/buildcraft/api/transport/pipe/PipeEventItem.java b/api/buildcraft/api/transport/pipe/PipeEventItem.java index e049029..86a3fbf 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventItem.java +++ b/api/buildcraft/api/transport/pipe/PipeEventItem.java @@ -1,23 +1,16 @@ package buildcraft.api.transport.pipe; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.EnumSet; -import java.util.List; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.*; public abstract class PipeEventItem extends PipeEvent { @@ -44,8 +37,8 @@ protected PipeEventItem(boolean canBeCancelled, IPipeHolder holder, IFlowItems f /** Fires whenever item insertion is attempted. The item might have been extracted by the pipe behaviour, inserted * by another pipe or even a different kind of tile. Note that you have no way of telling what caused this event. */ public static class TryInsert extends PipeEventItem { - public final EnumDyeColor colour; - public final EnumFacing from; + public final DyeColor colour; + public final Direction from; /** The itemstack that is attempting to be inserted. NEVER CHANGE THIS! */ @Nonnull public final ItemStack attempting; @@ -53,8 +46,8 @@ public static class TryInsert extends PipeEventItem { * {@link #attempting} */ public int accepted; - public TryInsert(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, EnumFacing from, - @Nonnull ItemStack attempting) { + public TryInsert(IPipeHolder holder, IFlowItems flow, DyeColor colour, Direction from, + @Nonnull ItemStack attempting) { super(true, holder, flow); this.colour = colour; this.from = from; @@ -70,11 +63,11 @@ public void cancel() { } public static abstract class ReachDest extends PipeEventItem { - public EnumDyeColor colour; + public DyeColor colour; @Nonnull private ItemStack stack; - public ReachDest(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, @Nonnull ItemStack stack) { + public ReachDest(IPipeHolder holder, IFlowItems flow, DyeColor colour, @Nonnull ItemStack stack) { super(holder, flow); this.colour = colour; this.stack = stack; @@ -96,10 +89,10 @@ public void setStack(ItemStack stack) { /** Fired after {@link TryInsert} (if some items were allowed in) to modify the incoming itemstack or its colour. */ public static class OnInsert extends ReachDest { - public final EnumFacing from; + public final Direction from; - public OnInsert(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, @Nonnull ItemStack stack, - EnumFacing from) { + public OnInsert(IPipeHolder holder, IFlowItems flow, DyeColor colour, @Nonnull ItemStack stack, + Direction from) { super(holder, flow, colour, stack); this.from = from; } @@ -107,10 +100,10 @@ public OnInsert(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, @Nonnu /** Fired whenever an item reaches the centre of a pipe. Note that you *can* change the itemstack or the colour. */ public static class ReachCenter extends ReachDest { - public final EnumFacing from; + public final Direction from; - public ReachCenter(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, @Nonnull ItemStack stack, - EnumFacing from) { + public ReachCenter(IPipeHolder holder, IFlowItems flow, DyeColor colour, @Nonnull ItemStack stack, + Direction from) { super(holder, flow, colour, stack); this.from = from; } @@ -118,10 +111,10 @@ public ReachCenter(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, @No /** Fired whenever an item reaches the end of a pipe. Note that you *can* change the itemstack or the colour. */ public static class ReachEnd extends ReachDest { - public final EnumFacing to; + public final Direction to; - public ReachEnd(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, @Nonnull ItemStack stack, - EnumFacing to) { + public ReachEnd(IPipeHolder holder, IFlowItems flow, DyeColor colour, @Nonnull ItemStack stack, + Direction to) { super(holder, flow, colour, stack); this.to = to; } @@ -139,9 +132,9 @@ public static abstract class Ejected extends PipeEventItem { private ItemStack excess; /** The side that the item has been ejected to. */ - public final EnumFacing to; + public final Direction to; - protected Ejected(IPipeHolder holder, IFlowItems flow, ItemStack inserted, ItemStack excess, EnumFacing to) { + protected Ejected(IPipeHolder holder, IFlowItems flow, ItemStack inserted, ItemStack excess, Direction to) { super(holder, flow); this.inserted = inserted; this.excess = excess; @@ -165,7 +158,7 @@ public void setExcess(ItemStack stack) { public static class IntoPipe extends Ejected { public final IFlowItems otherPipe; - public IntoPipe(IPipeHolder holder, IFlowItems flow, ItemStack inserted, ItemStack excess, EnumFacing to, + public IntoPipe(IPipeHolder holder, IFlowItems flow, ItemStack inserted, ItemStack excess, Direction to, IFlowItems otherPipe) { super(holder, flow, inserted, excess, to); this.otherPipe = otherPipe; @@ -174,10 +167,10 @@ public IntoPipe(IPipeHolder holder, IFlowItems flow, ItemStack inserted, ItemSta /** Fired when an item is injected into a tile entity. (Refer to {@link Ejected} for more details) */ public static class IntoTile extends Ejected { - public final TileEntity tile; + public final BlockEntity tile; - public IntoTile(IPipeHolder holder, IFlowItems flow, ItemStack inserted, ItemStack excess, EnumFacing to, - TileEntity tile) { + public IntoTile(IPipeHolder holder, IFlowItems flow, ItemStack inserted, ItemStack excess, Direction to, + BlockEntity tile) { super(holder, flow, inserted, excess, to); this.tile = tile; } @@ -193,18 +186,18 @@ public IntoTile(IPipeHolder holder, IFlowItems flow, ItemStack inserted, ItemSta /** Fired after {@link ReachCenter} to determine what sides are the items NOT allowed to go to, and the order of * priority for the allowed sides. */ public static class SideCheck extends PipeEventItem { - public final EnumDyeColor colour; - public final EnumFacing from; + public final DyeColor colour; + public final Direction from; @Nonnull public final ItemStack stack; /** The priorities of each side. Stored inversely to the values given, so a higher priority will have a lower * value than a lower priority. */ private final int[] priority = new int[6]; - private final EnumSet allowed = EnumSet.allOf(EnumFacing.class); + private final EnumSet allowed = EnumSet.allOf(Direction.class); - public SideCheck(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, EnumFacing from, - @Nonnull ItemStack stack) { + public SideCheck(IPipeHolder holder, IFlowItems flow, DyeColor colour, Direction from, + @Nonnull ItemStack stack) { super(holder, flow); this.colour = colour; this.from = from; @@ -214,23 +207,23 @@ public SideCheck(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, EnumF /** Checks to see if a side if allowed. Note that this may return true even though a later handler might * disallow a side, so you should only use this to skip checking a side (for example a diamond pipe might not * check the filters for a specific side if its already been disallowed) */ - public boolean isAllowed(EnumFacing side) { + public boolean isAllowed(Direction side) { return allowed.contains(side); } /** Disallows the specific side(s) from being a destination for the item. If no sides are allowed, then * {@link TryBounce} will be fired to test if the item can bounce back. */ - public void disallow(EnumFacing... sides) { - for (EnumFacing side : sides) { + public void disallow(Direction... sides) { + for (Direction side : sides) { allowed.remove(side); } } - public void disallowAll(Collection sides) { + public void disallowAll(Collection sides) { allowed.removeAll(sides); } - public void disallowAllExcept(EnumFacing... sides) { + public void disallowAllExcept(Direction... sides) { allowed.retainAll(Lists.newArrayList(sides)); } @@ -238,23 +231,23 @@ public void disallowAll() { allowed.clear(); } - public void increasePriority(EnumFacing side) { + public void increasePriority(Direction side) { increasePriority(side, 1); } - public void increasePriority(EnumFacing side, int by) { + public void increasePriority(Direction side, int by) { priority[side.ordinal()] -= by; } - public void decreasePriority(EnumFacing side) { + public void decreasePriority(Direction side) { decreasePriority(side, 1); } - public void decreasePriority(EnumFacing side, int by) { + public void decreasePriority(Direction side, int by) { increasePriority(side, -by); } - public List> getOrder() { + public List> getOrder() { // Skip the calculations if the size is simple switch (allowed.size()) { case 0: @@ -277,15 +270,15 @@ public List> getOrder() { int[] ordered = Arrays.copyOf(priority, 6); Arrays.sort(ordered); int last = 0; - List> list = Lists.newArrayList(); + List> list = Lists.newArrayList(); for (int i = 0; i < 6; i++) { int current = ordered[i]; if (i != 0 && current == last) { continue; } last = current; - EnumSet set = EnumSet.noneOf(EnumFacing.class); - for (EnumFacing face : EnumFacing.VALUES) { + EnumSet set = EnumSet.noneOf(Direction.class); + for (Direction face : Direction.values()) { if (allowed.contains(face)) { if (priority[face.ordinal()] == current) { set.add(face); @@ -303,14 +296,14 @@ public List> getOrder() { /** Fired after {@link SideCheck} (if all sides were disallowed) to see if the item is allowed to bounce back to * where it was inserted. */ public static class TryBounce extends PipeEventItem { - public final EnumDyeColor colour; - public final EnumFacing from; + public final DyeColor colour; + public final Direction from; @Nonnull public final ItemStack stack; public boolean canBounce = false; - public TryBounce(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, EnumFacing from, - @Nonnull ItemStack stack) { + public TryBounce(IPipeHolder holder, IFlowItems flow, DyeColor colour, Direction from, + @Nonnull ItemStack stack) { super(holder, flow); this.colour = colour; this.from = from; @@ -319,9 +312,9 @@ public TryBounce(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, EnumF } public static class Drop extends PipeEventItem { - private final EntityItem entity; + private final ItemEntity entity; - public Drop(IPipeHolder holder, IFlowItems flow, EntityItem entity) { + public Drop(IPipeHolder holder, IFlowItems flow, ItemEntity entity) { super(holder, flow); this.entity = entity; } @@ -342,32 +335,32 @@ public void setStack(ItemStack stack) { } } - public EntityItem getEntity() { + public ItemEntity getEntity() { return this.entity; } } /** Base class for {@link Split} and {@link FindDest}. Do not listen to this directly! */ public static abstract class OrderedEvent extends PipeEventItem { - public final List> orderedDestinations; + public final List> orderedDestinations; - public OrderedEvent(IPipeHolder holder, IFlowItems flow, List> orderedDestinations) { + public OrderedEvent(IPipeHolder holder, IFlowItems flow, List> orderedDestinations) { super(holder, flow); this.orderedDestinations = orderedDestinations; } - public EnumSet getAllPossibleDestinations() { - EnumSet set = EnumSet.noneOf(EnumFacing.class); - for (EnumSet e : orderedDestinations) { + public EnumSet getAllPossibleDestinations() { + EnumSet set = EnumSet.noneOf(Direction.class); + for (EnumSet e : orderedDestinations) { set.addAll(e); } return set; } - public ImmutableList generateRandomOrder() { - ImmutableList.Builder builder = ImmutableList.builder(); - for (EnumSet set : orderedDestinations) { - List faces = new ArrayList<>(set); + public ImmutableList generateRandomOrder() { + ImmutableList.Builder builder = ImmutableList.builder(); + for (EnumSet set : orderedDestinations) { + List faces = new ArrayList<>(set); Collections.shuffle(faces); builder.addAll(faces); } @@ -382,7 +375,7 @@ public ImmutableList generateRandomOrder() { public static class Split extends OrderedEvent { public final List items = new ArrayList<>(); - public Split(IPipeHolder holder, IFlowItems flow, List> order, ItemEntry toSplit) { + public Split(IPipeHolder holder, IFlowItems flow, List> order, ItemEntry toSplit) { super(holder, flow, order); items.add(toSplit); } @@ -394,7 +387,7 @@ public Split(IPipeHolder holder, IFlowItems flow, List> orde public static class FindDest extends OrderedEvent { public final ImmutableList items; - public FindDest(IPipeHolder holder, IFlowItems flow, List> orderedDestinations, + public FindDest(IPipeHolder holder, IFlowItems flow, List> orderedDestinations, ImmutableList items) { super(holder, flow, orderedDestinations); this.items = items; @@ -422,15 +415,15 @@ public void modifyTo(double target, double maxDelta) { /** Mostly immutable holding class for item stacks. */ public static class ItemEntry { - public final EnumDyeColor colour; + public final DyeColor colour; @Nonnull public final ItemStack stack; - public final EnumFacing from; + public final Direction from; /** The list of the destinations to try, in order. */ @Nullable - public List to; + public List to; - public ItemEntry(EnumDyeColor colour, @Nonnull ItemStack stack, EnumFacing from) { + public ItemEntry(DyeColor colour, @Nonnull ItemStack stack, Direction from) { this.colour = colour; this.stack = stack; this.from = from; diff --git a/api/buildcraft/api/transport/pipe/PipeEventPower.java b/api/buildcraft/api/transport/pipe/PipeEventPower.java index 4e356eb..fc30a20 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventPower.java +++ b/api/buildcraft/api/transport/pipe/PipeEventPower.java @@ -1,8 +1,7 @@ package buildcraft.api.transport.pipe; -import net.minecraft.util.EnumFacing; - import buildcraft.api.mj.MjAPI; +import net.minecraft.core.Direction; public abstract class PipeEventPower extends PipeEvent { public final IFlowPower flow; @@ -74,18 +73,18 @@ public void setReceiver(boolean receiver) { } public static class PrimaryDirection extends PipeEventPower { - private EnumFacing facing; + private Direction facing; - public PrimaryDirection(IPipeHolder holder, IFlowPower flow, EnumFacing facing) { + public PrimaryDirection(IPipeHolder holder, IFlowPower flow, Direction facing) { super(holder, flow); this.facing = facing; } - public EnumFacing getFacing() { + public Direction getFacing() { return facing; } - public void setFacing(EnumFacing facing) { + public void setFacing(Direction facing) { this.facing = facing; } } diff --git a/api/buildcraft/api/transport/pipe/PipeEventStatement.java b/api/buildcraft/api/transport/pipe/PipeEventStatement.java index 5d96caf..7a236f0 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventStatement.java +++ b/api/buildcraft/api/transport/pipe/PipeEventStatement.java @@ -1,15 +1,13 @@ package buildcraft.api.transport.pipe; -import java.util.Collection; - -import javax.annotation.Nonnull; - -import net.minecraft.util.EnumFacing; - import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.IActionInternalSided; import buildcraft.api.statements.ITriggerInternal; import buildcraft.api.statements.ITriggerInternalSided; +import net.minecraft.core.Direction; + +import javax.annotation.Nonnull; +import java.util.Collection; public abstract class PipeEventStatement extends PipeEvent { public PipeEventStatement(IPipeHolder holder) { @@ -31,9 +29,9 @@ public static class AddTriggerInternalSided extends PipeEventStatement { public final Collection triggers; @Nonnull - public final EnumFacing side; + public final Direction side; - public AddTriggerInternalSided(IPipeHolder holder, Collection triggers, @Nonnull EnumFacing side) { + public AddTriggerInternalSided(IPipeHolder holder, Collection triggers, @Nonnull Direction side) { super(holder); this.triggers = triggers; this.side = side; @@ -55,9 +53,9 @@ public static class AddActionInternalSided extends PipeEventStatement { public final Collection actions; @Nonnull - public final EnumFacing side; + public final Direction side; - public AddActionInternalSided(IPipeHolder holder, Collection actions, @Nonnull EnumFacing side) { + public AddActionInternalSided(IPipeHolder holder, Collection actions, @Nonnull Direction side) { super(holder); this.actions = actions; this.side = side; diff --git a/api/buildcraft/api/transport/pipe/PipeEventTileState.java b/api/buildcraft/api/transport/pipe/PipeEventTileState.java index 1847561..606a435 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventTileState.java +++ b/api/buildcraft/api/transport/pipe/PipeEventTileState.java @@ -1,6 +1,6 @@ package buildcraft.api.transport.pipe; -import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.level.block.entity.BlockEntity; /** Fired when the state of a pipe's tile entity changes. Listen for subclasses, not this one! */ public abstract class PipeEventTileState extends PipeEvent { @@ -8,21 +8,21 @@ public abstract class PipeEventTileState extends PipeEvent { super(holder); } - /** Fired in {@link TileEntity#invalidate()} */ + /** Fired in {@link BlockEntity#invalidate()} */ public static class Invalidate extends PipeEventTileState { public Invalidate(IPipeHolder holder) { super(holder); } } - /** Fired in {@link TileEntity#validate()} */ + /** Fired in {@link BlockEntity#validate()} */ public static class Validate extends PipeEventTileState { public Validate(IPipeHolder holder) { super(holder); } } - /** Fired in {@link TileEntity#onChunkUnload()} */ + /** Fired in {@link BlockEntity#onChunkUnloaded()} */ public static class ChunkUnload extends PipeEventTileState { public ChunkUnload(IPipeHolder holder) { super(holder); diff --git a/api/buildcraft/api/transport/pipe/PipeFaceTex.java b/api/buildcraft/api/transport/pipe/PipeFaceTex.java index 2c90354..8506d4e 100644 --- a/api/buildcraft/api/transport/pipe/PipeFaceTex.java +++ b/api/buildcraft/api/transport/pipe/PipeFaceTex.java @@ -2,7 +2,8 @@ import java.util.Arrays; -public class PipeFaceTex { +public class PipeFaceTex +{ private static final int SINGLE_WHITE_SPRITES_COUNT = 64; private static final PipeFaceTex[] SINGLE_WHITE_SPRITES; diff --git a/api/buildcraft/api/transport/pipe/PipeFlow.java b/api/buildcraft/api/transport/pipe/PipeFlow.java index 3ec2117..b44c6cc 100644 --- a/api/buildcraft/api/transport/pipe/PipeFlow.java +++ b/api/buildcraft/api/transport/pipe/PipeFlow.java @@ -1,92 +1,121 @@ package buildcraft.api.transport.pipe; -import java.io.IOException; - -import javax.annotation.Nonnull; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.NonNullList; -import net.minecraft.util.math.RayTraceResult; - -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.fml.relauncher.Side; - import buildcraft.api.core.EnumPipePart; import buildcraft.api.transport.pipe.IPipeHolder.IWriter; import buildcraft.api.transport.pipe.IPipeHolder.PipeMessageReceiver; +import net.minecraft.core.Direction; +import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.phys.HitResult; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.network.NetworkDirection; -public abstract class PipeFlow implements ICapabilityProvider { - /** The ID for completely refreshing the state of this flow. */ +import javax.annotation.Nonnull; +import java.io.IOException; + +public abstract class PipeFlow implements ICapabilityProvider +{ + /** + * The ID for completely refreshing the state of this flow. + */ public static final int NET_ID_FULL_STATE = 0; - /** The ID for updating what has changed since the last NET_ID_FULL_STATE or NET_ID_UPDATE has been sent. */ + /** + * The ID for updating what has changed since the last NET_ID_FULL_STATE or NET_ID_UPDATE has been sent. + */ // Wait, what? How is that a good idea or even sensible to make updates work this way? public static final int NET_ID_UPDATE = 1; public final IPipe pipe; - public PipeFlow(IPipe pipe) { + public PipeFlow(IPipe pipe) + { this.pipe = pipe; } - public PipeFlow(IPipe pipe, NBTTagCompound nbt) { + public PipeFlow(IPipe pipe, CompoundTag nbt) + { this.pipe = pipe; } - public NBTTagCompound writeToNbt() { - return new NBTTagCompound(); + public CompoundTag writeToNbt() + { + return new CompoundTag(); } - /** Writes a payload with the specified id. Standard ID's are NET_ID_FULL_STATE and NET_ID_UPDATE. */ - public void writePayload(int id, PacketBuffer buffer, Side side) {} + /** + * Writes a payload with the specified id. Standard ID's are NET_ID_FULL_STATE and NET_ID_UPDATE. + */ + public void writePayload(int id, FriendlyByteBuf buffer, Dist side) + { + } - /** Reads a payload with the specified id. Standard ID's are NET_ID_FULL_STATE and NET_ID_UPDATE. */ - public void readPayload(int id, PacketBuffer buffer, Side side) throws IOException {} + /** + * Reads a payload with the specified id. Standard ID's are NET_ID_FULL_STATE and NET_ID_UPDATE. + */ + public void readPayload(int id, FriendlyByteBuf buffer, NetworkDirection side) throws IOException + { + } - public void sendPayload(int id) { - final Side side = pipe.getHolder().getPipeWorld().isRemote ? Side.CLIENT : Side.SERVER; + public void sendPayload(int id) + { + final Dist side = pipe.getHolder().getPipeWorld().isClientSide ? Dist.CLIENT : Dist.DEDICATED_SERVER; sendCustomPayload(id, (buf) -> writePayload(id, buf, side)); } - public final void sendCustomPayload(int id, IWriter writer) { - pipe.getHolder().sendMessage(PipeMessageReceiver.FLOW, buffer -> { + public final void sendCustomPayload(int id, IWriter writer) + { + pipe.getHolder().sendMessage(PipeMessageReceiver.FLOW, buffer -> + { buffer.writeBoolean(true); buffer.writeShort(id); writer.write(buffer); }); } - public abstract boolean canConnect(EnumFacing face, PipeFlow other); + public abstract boolean canConnect(Direction face, PipeFlow other); - public abstract boolean canConnect(EnumFacing face, TileEntity oTile); + public abstract boolean canConnect(Direction face, BlockEntity oTile); - /** Used to force a connection to a given tile, even if the {@link PipeBehaviour} wouldn't normally connect to - * it. */ - public boolean shouldForceConnection(EnumFacing face, TileEntity oTile) { + /** + * Used to force a connection to a given tile, even if the {@link PipeBehaviour} wouldn't normally connect to + * it. + */ + public boolean shouldForceConnection(Direction face, BlockEntity oTile) + { return false; } - public void onTick() {} + public void onTick() + { + } - public void addDrops(NonNullList toDrop, int fortune) {} + public void addDrops(NonNullList toDrop, int fortune) + { + } - public boolean onFlowActivate(EntityPlayer player, RayTraceResult trace, float hitX, float hitY, float hitZ, - EnumPipePart part) { + public boolean onFlowActivate(Player player, HitResult trace, float hitX, float hitY, float hitZ, + EnumPipePart part) + { return false; } - @Override - public final boolean hasCapability(@Nonnull Capability capability, EnumFacing facing) { - return getCapability(capability, facing) != null; - } +// @Override +// public final boolean hasCapability(@Nonnull Capability capability, Direction facing) +// { +//// return getCapability(capability, facing) != null; +// return getCapability(capability, facing).isPresent(); +// } @Override - public T getCapability(@Nonnull Capability capability, EnumFacing facing) { - return null; + public LazyOptional getCapability(@Nonnull Capability capability, Direction facing) + { + return LazyOptional.empty(); } } diff --git a/api/buildcraft/api/transport/pipe/PipeFlowType.java b/api/buildcraft/api/transport/pipe/PipeFlowType.java index fb79d40..c247206 100644 --- a/api/buildcraft/api/transport/pipe/PipeFlowType.java +++ b/api/buildcraft/api/transport/pipe/PipeFlowType.java @@ -1,8 +1,9 @@ package buildcraft.api.transport.pipe; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundTag; -public final class PipeFlowType { +public final class PipeFlowType +{ public final IFlowCreator creator; public final IFlowLoader loader; @@ -27,6 +28,6 @@ public interface IFlowCreator { @FunctionalInterface public interface IFlowLoader { - PipeFlow loadFlow(IPipe t, NBTTagCompound u); + PipeFlow loadFlow(IPipe t, CompoundTag u); } } diff --git a/api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java b/api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java index 1a71aa3..18664dc 100644 --- a/api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java +++ b/api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java @@ -1,8 +1,10 @@ package buildcraft.api.transport.pluggable; -import net.minecraft.client.renderer.BufferBuilder; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; public interface IPlugDynamicRenderer

{ - void render(P plug, double x, double y, double z, float partialTicks, BufferBuilder bb); +// void render(P plug, double x, double y, double z, float partialTicks, VertexConsumer bb); + void render(P gate, float partialTicks, PoseStack poseStack, VertexConsumer vertexConsumer, int combinedLight, int combinedOverlay); } diff --git a/api/buildcraft/api/transport/pluggable/IPluggableRegistry.java b/api/buildcraft/api/transport/pluggable/IPluggableRegistry.java index 243731c..5fa459a 100644 --- a/api/buildcraft/api/transport/pluggable/IPluggableRegistry.java +++ b/api/buildcraft/api/transport/pluggable/IPluggableRegistry.java @@ -1,6 +1,6 @@ package buildcraft.api.transport.pluggable; -import net.minecraft.util.ResourceLocation; +import net.minecraft.resources.ResourceLocation; public interface IPluggableRegistry { default void register(PluggableDefinition definition) { diff --git a/api/buildcraft/api/transport/pluggable/IPluggableStaticBaker.java b/api/buildcraft/api/transport/pluggable/IPluggableStaticBaker.java index a3f0012..f33eb34 100644 --- a/api/buildcraft/api/transport/pluggable/IPluggableStaticBaker.java +++ b/api/buildcraft/api/transport/pluggable/IPluggableStaticBaker.java @@ -1,13 +1,12 @@ package buildcraft.api.transport.pluggable; -import java.util.List; - import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public interface IPluggableStaticBaker { List bake(K key); } diff --git a/api/buildcraft/api/transport/pluggable/PipePluggable.java b/api/buildcraft/api/transport/pluggable/PipePluggable.java index 73d22b6..5d6d91b 100644 --- a/api/buildcraft/api/transport/pluggable/PipePluggable.java +++ b/api/buildcraft/api/transport/pluggable/PipePluggable.java @@ -1,161 +1,214 @@ package buildcraft.api.transport.pluggable; -import java.io.IOException; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.block.Block; -import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.NonNullList; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - +import buildcraft.api.transport.pipe.IPipeHolder; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.network.NetworkDirection; +import net.minecraftforge.network.NetworkEvent; -import buildcraft.api.transport.pipe.IPipeHolder; -import buildcraft.api.transport.pipe.IPipeHolder.PipeMessageReceiver; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.io.IOException; -public abstract class PipePluggable { +public abstract class PipePluggable +{ public final PluggableDefinition definition; public final IPipeHolder holder; - public final EnumFacing side; + public final Direction side; - public PipePluggable(PluggableDefinition definition, IPipeHolder holder, EnumFacing side) { + public PipePluggable(PluggableDefinition definition, IPipeHolder holder, Direction side) + { this.definition = definition; this.holder = holder; this.side = side; } - public NBTTagCompound writeToNbt() { - NBTTagCompound nbt = new NBTTagCompound(); + public CompoundTag writeToNbt() + { + CompoundTag nbt = new CompoundTag(); return nbt; } - /** Writes the payload that will be passed into - * {@link PluggableDefinition#loadFromBuffer(IPipeHolder, EnumFacing, PacketBuffer)} on the client. (This is called - * on the server and sent to the client). Note that this will be called *instead* of write and read payload. */ - public void writeCreationPayload(PacketBuffer buffer) { + /** + * Writes the payload that will be passed into + * {@link PluggableDefinition#loadFromBuffer(IPipeHolder, Direction, FriendlyByteBuf)} on the client. (This is called + * on the server and sent to the client). Note that this will be called *instead* of write and read payload. + */ + public void writeCreationPayload(FriendlyByteBuf buffer) + { } - public void writePayload(PacketBuffer buffer, Side side) { + public void writePayload(FriendlyByteBuf buffer, Dist side) + { } - public void readPayload(PacketBuffer buffer, Side side, MessageContext ctx) throws IOException { + public void readPayload(FriendlyByteBuf buffer, NetworkDirection side, NetworkEvent.Context ctx) throws IOException + { } - public final void scheduleNetworkUpdate() { - holder.scheduleNetworkUpdate(PipeMessageReceiver.PLUGGABLES[side.ordinal()]); + public final void scheduleNetworkUpdate() + { + holder.scheduleNetworkUpdate(IPipeHolder.PipeMessageReceiver.PLUGGABLES[side.ordinal()]); } - public void onTick() {} + public void onTick() + { + } - /** @return A bounding box that will be used for collisions and raytracing. */ - public abstract AxisAlignedBB getBoundingBox(); + /** + * @return A bounding box that will be used for collisions and raytracing. + */ + public abstract VoxelShape getBoundingBox(); - /** @return True if the pipe cannot connect outwards (it is blocked), or False if this does not block the pipe. */ - public boolean isBlocking() { + /** + * @return True if the pipe cannot connect outwards (it is blocked), or False if this does not core the pipe. + */ + public boolean isBlocking() + { return false; } - /** Gets the value of a specified capability key, or null if the given capability is not supported at the call time. + /** + * Gets the value of a specified capability key, or null if the given capability is not supported at the call time. * This is effectively {@link ICapabilityProvider}, but where - * {@link ICapabilityProvider#hasCapability(Capability, EnumFacing)} will return true when this returns a non-null - * value. */ - public T getCapability(@Nonnull Capability cap) { - return null; + * {@link ICapabilityProvider#hasCapability(Capability, Direction)} will return true when this returns a non-null + * value. + */ + public LazyOptional getCapability(@Nonnull Capability cap) + { + return LazyOptional.empty(); } - /** Gets the {@link Capability} that is accessible from the pipe that this is attached to. - * + /** + * Gets the {@link Capability} that is accessible from the pipe that this is attached to. + * * @param cap - * @return */ - public T getInternalCapability(@Nonnull Capability cap) { + * @return + */ + public T getInternalCapability(@Nonnull Capability cap) + { return null; } - /** Called whenever this pluggable is removed from the pipe. */ - public void onRemove() {} + /** + * Called whenever this pluggable is removed from the pipe. + */ + public void onRemove() + { + } - /** @param toDrop A list containing all the items to drop (so you should add your items to this list) */ - public void addDrops(NonNullList toDrop, int fortune) { + /** + * @param toDrop A list containing all the items to drop (so you should add your items to this list) + */ + public void addDrops(NonNullList toDrop, int fortune) + { ItemStack stack = getPickStack(); - if (!stack.isEmpty()) { + if (!stack.isEmpty()) + { toDrop.add(stack); } } - /** Called whenever this pluggable is picked by the player (similar to Block.getPickBlock) - * - * @return The stack that should be picked, or ItemStack.EMPTY if no stack can be picked from this pluggable. */ - public ItemStack getPickStack() { + /** + * Called whenever this pluggable is picked by the player (similar to Block.getPickBlock) + * + * @return The stack that should be picked, or ItemStack.EMPTY if no stack can be picked from this pluggable. + */ + public ItemStack getPickStack() + { return ItemStack.EMPTY; } - public boolean onPluggableActivate(EntityPlayer player, RayTraceResult trace, float hitX, float hitY, float hitZ) { + public boolean onPluggableActivate(Player player, HitResult trace, float hitX, float hitY, float hitZ) + { return false; } + @OnlyIn(Dist.CLIENT) @Nullable - public PluggableModelKey getModelRenderKey(BlockRenderLayer layer) { + public PluggableModelKey getModelRenderKey(RenderType layer) + { return null; } - /** Called if the {@link IPluggableStaticBaker} returns quads with tint indexes set to + /** + * Called if the {@link IPluggableStaticBaker} returns quads with tint indexes set to * data * 6 + key.side.ordinal(). "data" is passed in here as "tintIndex". - * - * @return The tint index to render the quad with, or -1 for default. */ - @SideOnly(Side.CLIENT) - public int getBlockColor(int tintIndex) { + * + * @return The tint index to render the quad with, or -1 for default. + */ + @OnlyIn(Dist.CLIENT) + public int getBlockColor(int tintIndex) + { return -1; } - /** PipePluggable version of - * {@link Block#canBeConnectedTo(net.minecraft.world.IBlockAccess, net.minecraft.util.math.BlockPos, EnumFacing)}. */ - public boolean canBeConnected() { + /** + * PipePluggable version of + * {@link Block#canBeConnectedTo(net.minecraft.world.level.LevelAccessor, BlockPos, Direction)}. + */ + public boolean canBeConnected() + { return false; } - /** PipePluggable version of - * {@link net.minecraft.block.state.IBlockState#isSideSolid(IBlockAccess, BlockPos, EnumFacing)} */ - public boolean isSideSolid() { + /** + * PipePluggable version of + * {@link BlockState#isSideSolid(IBlockAccess, BlockPos, Direction)} + */ + public boolean isSideSolid() + { return false; } - /** PipePluggable version of {@link Block#getExplosionResistance(World, BlockPos, Entity, Explosion)} */ - public float getExplosionResistance(@Nullable Entity exploder, Explosion explosion) { + /** + * PipePluggable version of {@link Block#getExplosionResistance(Level, BlockPos, Entity, Explosion)} + */ +// public float getExplosionResistance(@Nullable Entity exploder, Explosion explosion) + public float getExplosionResistance(@Nonnull Entity exploder, Explosion explosion) + { return 0; } - public boolean canConnectToRedstone(@Nullable EnumFacing to) { + public boolean canConnectToRedstone(@Nullable Direction to) + { return false; } - /** PipePluggable version of - * {@link net.minecraft.block.state.IBlockState#getBlockFaceShape(IBlockAccess, BlockPos, EnumFacing)} */ - public BlockFaceShape getBlockFaceShape() { - return BlockFaceShape.UNDEFINED; - } - - public void onPlacedBy(EntityPlayer player) { + // Calen: seems use block Shape in 1.18.2 +// /** +// * PipePluggable version of +// * {@link net.minecraft.core.state.BlockState#getBlockFaceShape(LevelAccessor, BlockPos, Direction)} +// */ +// public BlockFaceShape getBlockFaceShape() +// public SupportType getBlockFaceShape() +// { +//// return BlockFaceShape.UNDEFINED; +// return SupportType.FULL; +// } + + public void onPlacedBy(Player player) + { } } diff --git a/api/buildcraft/api/transport/pluggable/PluggableDefinition.java b/api/buildcraft/api/transport/pluggable/PluggableDefinition.java index 4d7fdaa..cba05b3 100644 --- a/api/buildcraft/api/transport/pluggable/PluggableDefinition.java +++ b/api/buildcraft/api/transport/pluggable/PluggableDefinition.java @@ -1,16 +1,16 @@ package buildcraft.api.transport.pluggable; -import javax.annotation.Nullable; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; - import buildcraft.api.core.InvalidInputDataException; import buildcraft.api.transport.pipe.IPipeHolder; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; + +import javax.annotation.Nullable; -public final class PluggableDefinition { +public final class PluggableDefinition +{ public final ResourceLocation identifier; public final IPluggableNetLoader loader; @@ -33,11 +33,11 @@ public PluggableDefinition(ResourceLocation identifier, @Nullable IPluggableCrea this.creator = creator; } - public PipePluggable readFromNbt(IPipeHolder holder, EnumFacing side, NBTTagCompound nbt) { + public PipePluggable readFromNbt(IPipeHolder holder, Direction side, CompoundTag nbt) { return reader.readFromNbt(this, holder, side, nbt); } - public PipePluggable loadFromBuffer(IPipeHolder holder, EnumFacing side, PacketBuffer buffer) + public PipePluggable loadFromBuffer(IPipeHolder holder, Direction side, FriendlyByteBuf buffer) throws InvalidInputDataException { return loader.loadFromBuffer(this, holder, side, buffer); } @@ -47,30 +47,30 @@ public interface IPluggableNbtReader { /** Reads the pipe pluggable from NBT. Unlike {@link IPluggableNetLoader} (which is allowed to fail and throw an * exception if the wrong data is given) this should make a best effort to read the pluggable from nbt, or fall * back to sensible defaults. */ - PipePluggable readFromNbt(PluggableDefinition definition, IPipeHolder holder, EnumFacing side, - NBTTagCompound nbt); + PipePluggable readFromNbt(PluggableDefinition definition, IPipeHolder holder, Direction side, + CompoundTag nbt); } @FunctionalInterface public interface IPluggableNetLoader { - PipePluggable loadFromBuffer(PluggableDefinition definition, IPipeHolder holder, EnumFacing side, - PacketBuffer buffer) throws InvalidInputDataException; + PipePluggable loadFromBuffer(PluggableDefinition definition, IPipeHolder holder, Direction side, + FriendlyByteBuf buffer) throws InvalidInputDataException; } @FunctionalInterface public interface IPluggableCreator extends IPluggableNbtReader, IPluggableNetLoader { @Override - default PipePluggable loadFromBuffer(PluggableDefinition definition, IPipeHolder holder, EnumFacing side, - PacketBuffer buffer) { + default PipePluggable loadFromBuffer(PluggableDefinition definition, IPipeHolder holder, Direction side, + FriendlyByteBuf buffer) { return createSimplePluggable(definition, holder, side); } @Override - default PipePluggable readFromNbt(PluggableDefinition definition, IPipeHolder holder, EnumFacing side, - NBTTagCompound nbt) { + default PipePluggable readFromNbt(PluggableDefinition definition, IPipeHolder holder, Direction side, + CompoundTag nbt) { return createSimplePluggable(definition, holder, side); } - PipePluggable createSimplePluggable(PluggableDefinition definition, IPipeHolder holder, EnumFacing side); + PipePluggable createSimplePluggable(PluggableDefinition definition, IPipeHolder holder, Direction side); } } diff --git a/api/buildcraft/api/transport/pluggable/PluggableModelKey.java b/api/buildcraft/api/transport/pluggable/PluggableModelKey.java index 7c832c1..0350616 100644 --- a/api/buildcraft/api/transport/pluggable/PluggableModelKey.java +++ b/api/buildcraft/api/transport/pluggable/PluggableModelKey.java @@ -1,17 +1,18 @@ package buildcraft.api.transport.pluggable; -import java.util.Objects; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.core.Direction; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; +import java.util.Objects; -public abstract class PluggableModelKey { - public final BlockRenderLayer layer; - public final EnumFacing side; +public abstract class PluggableModelKey +{ + public final RenderType layer; + public final Direction side; private final int hash; - public PluggableModelKey(BlockRenderLayer layer, EnumFacing side) { - if (layer != BlockRenderLayer.CUTOUT && layer != BlockRenderLayer.TRANSLUCENT) { + public PluggableModelKey(RenderType layer, Direction side) { + if (layer != RenderType.cutout() && layer != RenderType.translucent()) { throw new IllegalArgumentException("Can only use CUTOUT or TRANSLUCENT at the moment (was " + layer + ")"); } if (side == null) throw new NullPointerException("side"); diff --git a/build.gradle b/build.gradle index 0efb16f..efba5d9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,22 +1,32 @@ - -// For those who want the bleeding edge buildscript { repositories { - jcenter() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } + // These repositories are only for Gradle plugins, put any other repositories in the repository core further below + maven { url = 'https://maven.minecraftforge.net' } +// maven { url = 'https://maven.parchmentmc.org' } + mavenCentral() } dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT" + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + // Mixin + //classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT' + classpath 'org.spongepowered:mixingradle:0.7.+' + classpath 'javax.vecmath:vecmath:1.5.2' } } -apply plugin: "net.minecraftforge.gradle.forge" - -if (gradle.startParameter.taskNames.contains("checkstyle")) { - apply plugin: "checkstyle" +// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. +plugins { + id 'eclipse' + id 'maven-publish' +// id 'net.minecraftforge.gradle' version '5.+' +// id 'org.parchmentmc.librarian.forgegradle' version '1.+' } +apply plugin: 'net.minecraftforge.gradle' +// +////apply plugin: 'org.parchmentmc.librarian.forgegradle' version '1.+' +// +// Mixin +apply plugin: 'org.spongepowered.mixin' + ext.configFile = file "build.properties" configFile.withReader { @@ -27,25 +37,137 @@ configFile.withReader { } version = config.mod_version -group= "com.mod-buildcraft.api" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +group= "com.mod-buildcraft.api" archivesBaseName = "buildcraft-api" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension] -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. +java.toolchain.languageVersion = JavaLanguageVersion.of(17) +println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { - version = config.mc_version + "-" + config.forge_version - runDir = "run" - - // the mappings can be changed at any time, and must be in the following format. - // snapshot_YYYYMMDD snapshot are built nightly. - // stable_# stables are built at the discretion of the MCP team. - // Use non-default mappings at your own risk. they may not always work. - // simply re-run your setup task after changing the mappings to update your workspace. - mappings = config.mappings_version - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + // The mappings can be changed at any time and must be in the following format. + // Channel: Version: + // official MCVersion Official field/method names from Mojang mapping files + // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official + // + // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. + // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md + // + // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge + // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started + // + // Use non-default mappings at your own risk. They may not always work. + // Simply re-run your setup task after changing the mappings to update your workspace. + + mappings channel: config.mappings_channel, version: config.mappings_version +// mappings channel: 'parchment', version: '2022.08.07-1.18.2' + +// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + accessTransformer = file('buildcraft_resources/META-INF/accesstransformer.cfg') + // Currently, this location cannot be changed from the default. + + // Default run configurations. + // These can be tweaked, removed, or duplicated as needed. + runs { + client { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + property 'forge.logging.console.level', 'debug' + + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'buildcraftcore,buildcraftenergy,buildcraftfactory,buildcraftlib' + + // Mixin + arg "-mixin.config=mixins.buildcraft.json" + + mods { + buildcraftcore { + source sourceSets.main + } + } + } + + server { + workingDirectory project.file('run') + + property 'forge.logging.markers', 'REGISTRIES' + + property 'forge.logging.console.level', 'debug' + + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'buildcraftcore' + + // Mixin + arg "-mixin.config=mixins.buildcraft.json" + + mods { + buildcraftcore { + source sourceSets.main + } + } + } + + // This run config launches GameTestServer and runs all registered gametests, then exits. + // By default, the server will crash when no gametests are provided. + // The gametest system is also enabled by default for other run configs under the /test command. + gameTestServer { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + property 'forge.logging.console.level', 'debug' + + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'buildcraftcore' + + mods { + buildcraftcore { + source sourceSets.main + } + } + } + + data { + workingDirectory project.file('run') + + property 'forge.logging.markers', 'REGISTRIES' + + property 'forge.logging.console.level', 'debug' + +// property 'forge.enabledGameTestNamespaces', 'buildcraftcore,buildcraftenergy,buildcraftfactory,buildcraftlib' + + // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. + args '--mod', 'buildcraftcore', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + + + mods { + buildcraftcore { + source sourceSets.main + } + } + } + } } +// Include resources generated by data generators. sourceSets { main { java { @@ -54,58 +176,91 @@ sourceSets { } } -if (gradle.startParameter.taskNames.contains("checkstyle")) { - checkstyle { - configFile = file("guidelines/buildcraft.checkstyle") - } - task checkstyle {} - tasks["checkstyle"].dependsOn checkstyleApi - tasks["checkstyle"].dependsOn checkstyleMain +repositories { + // Put repositories for dependencies here + // ForgeGradle automatically adds the Forge maven and Maven Central for you - tasks["checkstyleApi"].enabled = gradle.startParameter.taskNames.contains("checkstyle") - tasks["checkstyleMain"].enabled = gradle.startParameter.taskNames.contains("checkstyle") + // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: + // flatDir { + // dir 'libs' + // } + + maven { + name 'CurseMaven' + url 'https://www.cursemaven.com' + content { + includeGroup 'curse.maven' + } + } } -processResources -{ - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version +// Mixin +mixin { + add sourceSets.main, "refmap.buildcraft.json" + config 'mixins.buildcraft.json' + mixin.env.remapRefMap = true + debug = true + debug.verbose = true + debug.export = true +} - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' +dependencies { + // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed + // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. + // The userdev artifact is a special name and will get all sorts of transformations applied to it. - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } +// minecraft 'net.minecraftforge:forge:1.18.2-40.1.0' + minecraft 'net.minecraftforge:forge:1.18.2-40.2.14' - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } -} + // Examples using mod jars from ./libs -compileJava { - options.compilerArgs << "-Xmaxerrs" << "2000" - options.compilerArgs << "-Xmaxwarns" << "2" - options.compilerArgs << "-Xlint:all" - options.compilerArgs << "-Xdiags:verbose" - options.compilerArgs << "-encoding" << "UTF-8" + + annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' + // For more info... + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html + // http://www.gradle.org/docs/current/userguide/dependency_management.html } -javadoc { - options.setUse(true) - options.addStringsOption("Xmaxerrs").setValue(["2000"]) - options.addStringsOption("Xmaxwarns").setValue(["2"]) +// Example for how to get properties into the manifest for reading at runtime. +jar { + manifest { + attributes([ + "Specification-Title" : "BuildCraft", + "Specification-Vendor" : "BuildCraft Team", + "Specification-Version" : project.version, + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "BuildCraft Team", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + "MixinConfigs" : "mixins.buildcraft.json" + ]) + } + include '**/**/**/libs/*' } -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir +// Example configuration to allow publishing using the maven-publish plugin +// This is the preferred method to reobfuscate your jar file +jar.finalizedBy('reobfJar') +// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing +// publish.dependsOn('reobfJar') + +publishing { + publications { + mavenJava(MavenPublication) { + artifact jar + } + } + repositories { + maven { + url "file://${project.projectDir}/mcmodsrepo" + } + } } -artifacts { - archives javadocJar +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation } + +jar.enabled = true + diff --git a/build.properties b/build.properties index d21cfb0..d1d14bc 100644 --- a/build.properties +++ b/build.properties @@ -1,4 +1,5 @@ -mc_version=1.12.2 -forge_version=14.23.0.2532 -mappings_version=snapshot_20170629 +mc_version=1.18.2 +forge_version=40.2.14 +mappings_channel=official +mappings_version=1.18.2 mod_version=7.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HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn ( ) { +warn () { echo "$*" -} +} >&2 -die ( ) { +die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -82,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -90,75 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index aec9973..ac1b06f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -8,20 +24,23 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,34 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell From bf5fce1f591fb2e903f5f1e3da7dd48d0999f471 Mon Sep 17 00:00:00 2001 From: LRW-Calen Date: Sat, 13 Apr 2024 02:37:59 +0800 Subject: [PATCH 02/20] Var types and method links in comments --- api/buildcraft/api/data/NbtSquishConstants.java | 10 ++++++++-- api/buildcraft/api/registry/IScriptableRegistry.java | 2 +- api/buildcraft/api/statements/IGuiSlot.java | 2 +- api/buildcraft/api/statements/StatementManager.java | 12 ++++++------ .../api/statements/StatementParameterItemStack.java | 4 ++-- .../api/transport/pipe/IPipeFlowRenderer.java | 5 +---- .../api/transport/pipe/PipeEventFluid.java | 4 ++-- .../api/transport/pipe/PipeEventTileState.java | 4 ++-- 8 files changed, 23 insertions(+), 20 deletions(-) diff --git a/api/buildcraft/api/data/NbtSquishConstants.java b/api/buildcraft/api/data/NbtSquishConstants.java index eeff60e..0295136 100644 --- a/api/buildcraft/api/data/NbtSquishConstants.java +++ b/api/buildcraft/api/data/NbtSquishConstants.java @@ -1,13 +1,19 @@ package buildcraft.api.data; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtAccounter; +import net.minecraft.nbt.NbtIo; + +import java.io.DataInput; +import java.io.DataOutput; import java.util.zip.GZIPInputStream; public class NbtSquishConstants { /** Default written NBT Tag type- this is provided by - * {@link CompressedStreamTools#write(CompoundTag, java.io.DataOutput)} and - * {@link CompressedStreamTools#read(java.io.DataInput, net.minecraft.nbt.NBTSizeTracker)}. + * {@link NbtIo#write(CompoundTag, DataOutput)} and + * {@link NbtIo#read(DataInput, NbtAccounter)}. * * Generally more suited to smaller NBT tags, and it writes fairly quickly. Can quickly use up a lot of space for * larger/more complex tags so it is recommended that you also pass it through a GZIP compressor to take up a much diff --git a/api/buildcraft/api/registry/IScriptableRegistry.java b/api/buildcraft/api/registry/IScriptableRegistry.java index dd39be8..734251b 100644 --- a/api/buildcraft/api/registry/IScriptableRegistry.java +++ b/api/buildcraft/api/registry/IScriptableRegistry.java @@ -35,7 +35,7 @@ default void addCustomType(String name, IEntryDeserializer deserial } /** @return A {@link Set} (likely unmodifiable) that contains all of the - * {@link ResourceLocation#getResourceDomain()}'s that had added entries to this registry through + * {@link ResourceLocation#getNamespace()}'s that had added entries to this registry through * scripts. */ Set getSourceDomains(); diff --git a/api/buildcraft/api/statements/IGuiSlot.java b/api/buildcraft/api/statements/IGuiSlot.java index b6c1195..e849ad2 100644 --- a/api/buildcraft/api/statements/IGuiSlot.java +++ b/api/buildcraft/api/statements/IGuiSlot.java @@ -18,7 +18,7 @@ public interface IGuiSlot extends IConvertable * * @return the unique id */ - BaseComponent getUniqueTag(); + String getUniqueTag(); /** * Return the description in the UI. Note that this should NEVER be called directly, instead this acts as a bridge diff --git a/api/buildcraft/api/statements/StatementManager.java b/api/buildcraft/api/statements/StatementManager.java index 36f0720..8ee8591 100644 --- a/api/buildcraft/api/statements/StatementManager.java +++ b/api/buildcraft/api/statements/StatementManager.java @@ -55,7 +55,7 @@ public static void registerActionProvider(IActionProvider provider) { } public static void registerStatement(IStatement statement) { - statements.put(statement.getUniqueTag().getString(), statement); + statements.put(statement.getUniqueTag(), statement); } public static void registerParameter(IParameterReader reader) { @@ -63,17 +63,17 @@ public static void registerParameter(IParameterReader reader) { } public static void registerParameter(IParameterReader reader, IParamReaderBuf bufReader) { - Component name = reader.readFromNbt(new CompoundTag()).getUniqueTag(); + String name = reader.readFromNbt(new CompoundTag()).getUniqueTag(); registerParameter(name, reader); registerParameter(name, bufReader); } - public static void registerParameter(Component name, IParameterReader reader) { - parameters.put(name.getString(), reader); + public static void registerParameter(String name, IParameterReader reader) { + parameters.put(name, reader); } - public static void registerParameter(Component name, IParamReaderBuf reader) { - paramsBuf.put(name.getString(), reader); + public static void registerParameter(String name, IParamReaderBuf reader) { + paramsBuf.put(name, reader); } public static List getExternalTriggers(Direction side, BlockEntity entity) { diff --git a/api/buildcraft/api/statements/StatementParameterItemStack.java b/api/buildcraft/api/statements/StatementParameterItemStack.java index d48bd66..053f333 100755 --- a/api/buildcraft/api/statements/StatementParameterItemStack.java +++ b/api/buildcraft/api/statements/StatementParameterItemStack.java @@ -184,9 +184,9 @@ public List getTooltipKey() } @Override - public BaseComponent getUniqueTag() + public String getUniqueTag() { - return new TextComponent("buildcraft:stack"); + return "buildcraft:stack"; } @Override diff --git a/api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java b/api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java index a9646d7..34a6a6b 100644 --- a/api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java +++ b/api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java @@ -5,10 +5,7 @@ public interface IPipeFlowRenderer { /** @param flow The flow to render - * @param x - * @param y - * @param z * @param bufferBuilder The (optional) vertex buffer that you can render into. Note that you can still do GL stuff. */ // void render(F flow, double x, double y, double z, float partialTicks, BufferBuilder bufferBuilder); - void render(F flow, float partialTicks, PoseStack poseStack, VertexConsumer vertexConsumer, int combinedLight, int combinedOverlay); + void render(F flow, float partialTicks, PoseStack poseStack, VertexConsumer bufferBuilder, int combinedLight, int combinedOverlay); } diff --git a/api/buildcraft/api/transport/pipe/PipeEventFluid.java b/api/buildcraft/api/transport/pipe/PipeEventFluid.java index 008b59a..7450be3 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventFluid.java +++ b/api/buildcraft/api/transport/pipe/PipeEventFluid.java @@ -46,14 +46,14 @@ public static class PreMoveToCentre extends PipeEventFluid { /** The maximum amount of fluid that the centre pipe could accept. */ public final int totalAcceptable; - /** Array of {@link Direction#getIndex()} to the maximum amount of fluid that a given side can offer. DO NOT + /** Array of {@link Direction#get3DDataValue()} to the maximum amount of fluid that a given side can offer. DO NOT * CHANGE THIS! */ public final int[] totalOffered; // Used for checking the state private final int[] totalOfferedCheck; - /** Array of {@link Direction#getIndex()} to the amount of fluid that the given side will actually offer to the + /** Array of {@link Direction#get3DDataValue()} to the amount of fluid that the given side will actually offer to the * centre. This should *never* be larger than */ public final int[] actuallyOffered; diff --git a/api/buildcraft/api/transport/pipe/PipeEventTileState.java b/api/buildcraft/api/transport/pipe/PipeEventTileState.java index 606a435..885c941 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventTileState.java +++ b/api/buildcraft/api/transport/pipe/PipeEventTileState.java @@ -8,14 +8,14 @@ public abstract class PipeEventTileState extends PipeEvent { super(holder); } - /** Fired in {@link BlockEntity#invalidate()} */ + /** Fired in {@link BlockEntity#setRemoved()} */ public static class Invalidate extends PipeEventTileState { public Invalidate(IPipeHolder holder) { super(holder); } } - /** Fired in {@link BlockEntity#validate()} */ + /** Fired in {@link BlockEntity#clearRemoved()} */ public static class Validate extends PipeEventTileState { public Validate(IPipeHolder holder) { super(holder); From d2fa65a4bb54cc01a078076c6f0cd0eb5627716e Mon Sep 17 00:00:00 2001 From: LRW-Calen Date: Sat, 13 Apr 2024 11:12:18 +0800 Subject: [PATCH 03/20] A few changes --- api/buildcraft/api/blocks/CustomRotationHelper.java | 4 ++-- api/buildcraft/api/statements/IGuiSlot.java | 1 - .../api/statements/StatementParameterItemStack.java | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/api/buildcraft/api/blocks/CustomRotationHelper.java b/api/buildcraft/api/blocks/CustomRotationHelper.java index dbc9ac0..7d784c6 100644 --- a/api/buildcraft/api/blocks/CustomRotationHelper.java +++ b/api/buildcraft/api/blocks/CustomRotationHelper.java @@ -11,6 +11,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.registries.ForgeRegistries; import java.util.List; import java.util.Map; @@ -26,8 +27,7 @@ public enum CustomRotationHelper private final Map> handlers = Maps.newIdentityHashMap(); public void registerHandlerForAll(Class blockClass, ICustomRotationHandler handler) { - // 不知道是不是应该这样遍历方块 - for (Block block : Registry.BLOCK.stream().toList()) { + for (Block block : ForgeRegistries.BLOCKS) { Class foundClass = block.getClass(); if (blockClass.isAssignableFrom(foundClass)) { diff --git a/api/buildcraft/api/statements/IGuiSlot.java b/api/buildcraft/api/statements/IGuiSlot.java index e849ad2..ca996f8 100644 --- a/api/buildcraft/api/statements/IGuiSlot.java +++ b/api/buildcraft/api/statements/IGuiSlot.java @@ -3,7 +3,6 @@ import buildcraft.api.core.IConvertable; import buildcraft.api.core.render.ISprite; import com.google.common.collect.ImmutableList; -import net.minecraft.network.chat.BaseComponent; import net.minecraft.network.chat.Component; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; diff --git a/api/buildcraft/api/statements/StatementParameterItemStack.java b/api/buildcraft/api/statements/StatementParameterItemStack.java index 053f333..af69789 100755 --- a/api/buildcraft/api/statements/StatementParameterItemStack.java +++ b/api/buildcraft/api/statements/StatementParameterItemStack.java @@ -10,7 +10,6 @@ import com.google.common.collect.ImmutableList; import net.minecraft.ChatFormatting; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.BaseComponent; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TextComponent; import net.minecraft.world.item.ItemStack; From 8f4b6f56f1c61e33601ef2c3563147d3048175f6 Mon Sep 17 00:00:00 2001 From: LRW-Calen Date: Sat, 13 Apr 2024 11:31:09 +0800 Subject: [PATCH 04/20] Revert the code style for file history --- api/buildcraft/api/BCModules.java | 57 ++++------- api/buildcraft/api/IBuildCraftMod.java | 3 +- .../api/blocks/CustomPaintHelper.java | 77 +++++---------- .../api/blocks/CustomRotationHelper.java | 10 +- .../api/blocks/ICustomPaintHandler.java | 5 +- .../api/blocks/ICustomRotationHandler.java | 3 +- .../api/boards/RedstoneBoardNBT.java | 3 +- .../api/boards/RedstoneBoardRegistry.java | 2 +- api/buildcraft/api/core/BCDebugging.java | 27 ++++-- api/buildcraft/api/core/BCLog.java | 6 +- api/buildcraft/api/core/BuildCraftAPI.java | 30 ++---- .../api/core/CapabilitiesHelper.java | 3 +- api/buildcraft/api/core/EnumPipePart.java | 8 +- api/buildcraft/api/core/IAreaProvider.java | 3 +- api/buildcraft/api/core/IConvertable.java | 3 +- api/buildcraft/api/core/IEngineType.java | 3 +- .../api/core/IFakePlayerProvider.java | 3 +- api/buildcraft/api/core/IFluidFilter.java | 4 +- api/buildcraft/api/core/IFluidHandlerAdv.java | 3 +- api/buildcraft/api/core/IPathProvider.java | 3 +- api/buildcraft/api/core/IPlayerOwned.java | 3 +- api/buildcraft/api/core/IStackFilter.java | 5 +- api/buildcraft/api/core/IWorldProperty.java | 3 +- api/buildcraft/api/core/IZone.java | 3 +- api/buildcraft/api/core/SafeTimeTracker.java | 9 +- api/buildcraft/api/core/render/ISprite.java | 3 +- api/buildcraft/api/crops/CropManager.java | 10 +- api/buildcraft/api/crops/ICropHandler.java | 4 +- .../api/data/NbtSquishConstants.java | 5 +- .../api/enums/EnumDecoratedBlock.java | 3 +- api/buildcraft/api/enums/EnumEngineType.java | 36 +++---- .../api/enums/EnumExchangePart.java | 6 +- .../api/enums/EnumLaserTableType.java | 3 +- .../api/enums/EnumMachineState.java | 3 +- .../api/enums/EnumOptionalSnapshotType.java | 3 +- api/buildcraft/api/enums/EnumPowerStage.java | 3 +- .../api/enums/EnumRedstoneChipset.java | 30 ++---- api/buildcraft/api/enums/EnumSpring.java | 5 +- .../api/events/BlockInteractionEvent.java | 3 +- .../api/events/BlockPlacedDownEvent.java | 3 +- .../api/events/PipePlacedEvent.java | 3 +- api/buildcraft/api/events/RobotEvent.java | 3 +- .../api/events/RobotPlacementEvent.java | 3 +- api/buildcraft/api/facades/FacadeAPI.java | 21 ++-- .../api/facades/IFacadeRegistry.java | 2 +- .../api/filler/IFilledTemplate.java | 3 +- .../api/filler/IFillerPatternShape.java | 4 +- .../api/fuels/BuildcraftFuelRegistry.java | 3 +- api/buildcraft/api/fuels/EnumCoolantType.java | 9 +- api/buildcraft/api/fuels/ICoolant.java | 25 ++--- api/buildcraft/api/fuels/ICoolantManager.java | 20 ++-- api/buildcraft/api/fuels/IFluidCoolant.java | 4 +- api/buildcraft/api/fuels/IFuel.java | 21 ++-- api/buildcraft/api/fuels/IFuelManager.java | 12 +-- api/buildcraft/api/fuels/ISolidCoolant.java | 3 +- api/buildcraft/api/imc/BcImcMessage.java | 18 ++-- .../api/inventory/IItemTransactor.java | 4 +- api/buildcraft/api/items/FluidItemDrops.java | 3 +- api/buildcraft/api/items/IItemFluidShard.java | 3 +- api/buildcraft/api/items/IMapLocation.java | 10 +- api/buildcraft/api/items/INamedItem.java | 6 +- .../api/lists/ListMatchHandler.java | 2 +- api/buildcraft/api/mj/ILaserTarget.java | 5 +- api/buildcraft/api/mj/ILaserTargetBlock.java | 3 +- api/buildcraft/api/mj/IMjConnector.java | 5 +- api/buildcraft/api/mj/IMjEffectManager.java | 3 +- api/buildcraft/api/mj/IMjPassiveProvider.java | 2 +- api/buildcraft/api/mj/IMjReceiver.java | 6 +- .../api/mj/IMjRedstoneReceiver.java | 3 +- api/buildcraft/api/mj/MjAPI.java | 47 ++++----- api/buildcraft/api/mj/MjBattery.java | 7 +- api/buildcraft/api/mj/MjCapabilityHelper.java | 26 ++--- api/buildcraft/api/power/IEngine.java | 4 +- api/buildcraft/api/power/IRedstoneEngine.java | 3 +- .../api/properties/BuildCraftProperties.java | 11 +-- .../api/recipes/AssemblyRecipe.java | 48 ++++------ .../api/recipes/AssemblyRecipeBasic.java | 39 +++----- .../api/recipes/AssemblyRecipeType.java | 3 +- .../api/recipes/BuildcraftRecipeRegistry.java | 6 +- .../recipes/IIntegrationRecipeProvider.java | 2 +- .../api/recipes/IRefineryRecipeManager.java | 39 +++----- .../api/recipes/IngredientStack.java | 29 ++---- .../api/recipes/StackDefinition.java | 3 +- .../registry/BuildCraftRegistryManager.java | 3 +- .../api/registry/EventBuildCraftReload.java | 9 +- .../registry/IReloadableRegistryManager.java | 7 +- .../api/registry/IScriptableRegistry.java | 12 ++- api/buildcraft/api/robots/AIRobot.java | 28 ++++-- api/buildcraft/api/robots/DockingStation.java | 26 +++-- .../api/robots/EntityRobotBase.java | 4 +- api/buildcraft/api/robots/ResourceId.java | 12 ++- .../api/robots/ResourceIdBlock.java | 2 +- api/buildcraft/api/robots/RobotManager.java | 3 +- .../api/schematics/ISchematicBlock.java | 5 +- .../api/schematics/ISchematicEntity.java | 3 +- .../api/schematics/SchematicBlockContext.java | 3 +- .../SchematicBlockFactoryRegistry.java | 33 ++++--- .../schematics/SchematicEntityContext.java | 3 +- .../SchematicEntityFactoryRegistry.java | 23 +++-- api/buildcraft/api/statements/IAction.java | 3 +- .../api/statements/IActionProvider.java | 3 +- .../api/statements/IActionReceptor.java | 3 +- api/buildcraft/api/statements/IGuiSlot.java | 15 +-- .../IOverrideDefaultStatements.java | 3 +- api/buildcraft/api/statements/IStatement.java | 5 +- .../api/statements/IStatementContainer.java | 3 +- .../api/statements/IStatementParameter.java | 4 +- api/buildcraft/api/statements/ITrigger.java | 3 +- .../statements/ITriggerExternalOverride.java | 3 +- .../api/statements/ITriggerProvider.java | 3 +- .../api/statements/StatementManager.java | 13 ++- .../api/statements/StatementMouseClick.java | 3 +- .../StatementParameterItemStack.java | 95 +++++++------------ .../api/statements/StatementSlot.java | 3 +- .../IRedstoneStatementContainer.java | 7 +- api/buildcraft/api/tiles/IControllable.java | 3 +- api/buildcraft/api/tiles/IDebuggable.java | 6 +- api/buildcraft/api/tiles/IHasWork.java | 5 +- api/buildcraft/api/tiles/IHeatable.java | 5 +- .../api/tiles/ITileAreaProvider.java | 3 +- api/buildcraft/api/tiles/TilesAPI.java | 18 ++-- api/buildcraft/api/tools/IToolWrench.java | 3 +- .../api/transport/EnumWirePart.java | 36 +++---- api/buildcraft/api/transport/IInjectable.java | 3 +- .../api/transport/IItemPluggable.java | 5 +- .../api/transport/IStripesHandlerItem.java | 2 +- .../api/transport/IWireEmitter.java | 3 +- .../api/transport/IWireManager.java | 3 +- api/buildcraft/api/transport/WireNode.java | 8 +- .../transport/pipe/EnumPipeColourType.java | 3 +- .../transport/pipe/ICustomPipeConnection.java | 3 +- .../api/transport/pipe/IFlowFluid.java | 9 +- .../api/transport/pipe/IFlowItems.java | 4 +- .../api/transport/pipe/IFlowPower.java | 2 +- .../api/transport/pipe/IItemPipe.java | 3 +- .../pipe/IPipeBehaviourRenderer.java | 2 +- .../api/transport/pipe/IPipeHolder.java | 21 ++-- .../api/transport/pipe/IPipeRegistry.java | 3 +- .../api/transport/pipe/PipeApi.java | 30 +++--- .../api/transport/pipe/PipeApiClient.java | 4 +- .../api/transport/pipe/PipeBehaviour.java | 17 ++-- .../api/transport/pipe/PipeConnectionAPI.java | 2 +- .../api/transport/pipe/PipeDefinition.java | 23 ++--- .../api/transport/pipe/PipeEvent.java | 3 +- .../api/transport/pipe/PipeEventFluid.java | 18 ++-- .../api/transport/pipe/PipeEventHandler.java | 10 +- .../api/transport/pipe/PipeEventItem.java | 21 ++-- .../api/transport/pipe/PipeFaceTex.java | 13 +-- .../api/transport/pipe/PipeFlow.java | 39 +++----- .../api/transport/pipe/PipeFlowType.java | 3 +- .../pluggable/IPlugDynamicRenderer.java | 2 +- .../transport/pluggable/PipePluggable.java | 69 +++++--------- .../pluggable/PluggableDefinition.java | 13 ++- .../pluggable/PluggableModelKey.java | 3 +- 154 files changed, 670 insertions(+), 973 deletions(-) diff --git a/api/buildcraft/api/BCModules.java b/api/buildcraft/api/BCModules.java index e48167a..94b3804 100644 --- a/api/buildcraft/api/BCModules.java +++ b/api/buildcraft/api/BCModules.java @@ -9,8 +9,7 @@ import java.util.List; import java.util.Locale; -public enum BCModules implements IBuildCraftMod -{ +public enum BCModules implements IBuildCraftMod { LIB, // Base module for all BC. CORE, @@ -38,10 +37,8 @@ public enum BCModules implements IBuildCraftMod private final String modId = BUILDCRAFT + lowerCaseName; private boolean loaded; - private static void checkLoadStatus() - { - if (hasChecked) - { + private static void checkLoadStatus() { + if (hasChecked) { return; } load0(); @@ -50,10 +47,8 @@ private static void checkLoadStatus() /** * Performs the actual loading of {@link #checkLoadStatus()}, except this is thread safe. */ - private static synchronized void load0() - { - if (hasChecked) - { + private static synchronized void load0() { + if (hasChecked) { return; } // Calen: loading events order is changed from 1.12.2 to 1.18.2... @@ -63,16 +58,13 @@ private static synchronized void load0() // throw new RuntimeException("You can only use BCModules.isLoaded from pre-init onwards!"); // } List found = new ArrayList<>(), missing = new ArrayList<>(); - for (BCModules module : VALUES) - { + for (BCModules module : VALUES) { module.loaded = ModList.get().isLoaded(module.modId); - if (module.loaded) - { + if (module.loaded) { found.add(module); } - else - { + else { missing.add(module); } } @@ -82,59 +74,48 @@ private static synchronized void load0() } @Nullable - public static BCModules getBcMod(String testModId) - { - for (BCModules mod : VALUES) - { - if (mod.modId.equals(testModId)) - { + public static BCModules getBcMod(String testModId) { + for (BCModules mod : VALUES) { + if (mod.modId.equals(testModId)) { return mod; } } return null; } - public static boolean isBcMod(String testModId) - { + public static boolean isBcMod(String testModId) { return getBcMod(testModId) != null; } - public static BCModules[] getLoadedModules() - { + public static BCModules[] getLoadedModules() { checkLoadStatus(); return loadedModules; } - public static BCModules[] getMissingModules() - { + public static BCModules[] getMissingModules() { checkLoadStatus(); return missingModules; } @Override - public String getModId() - { + public String getModId() { return modId; } - public boolean isLoaded() - { + public boolean isLoaded() { checkLoadStatus(); return loaded; } - public ResourceLocation createLocation(String path) - { + public ResourceLocation createLocation(String path) { return new ResourceLocation(getModId(), path); } - public ModelResourceLocation createModelLocation(String path, String variant) - { + public ModelResourceLocation createModelLocation(String path, String variant) { return new ModelResourceLocation(getModId() + ":" + path + "#" + variant); } - public ModelResourceLocation createModelLocation(String pathAndVariant) - { + public ModelResourceLocation createModelLocation(String pathAndVariant) { return new ModelResourceLocation(getModId() + ":" + pathAndVariant); } } diff --git a/api/buildcraft/api/IBuildCraftMod.java b/api/buildcraft/api/IBuildCraftMod.java index 632df64..b528ed4 100644 --- a/api/buildcraft/api/IBuildCraftMod.java +++ b/api/buildcraft/api/IBuildCraftMod.java @@ -1,8 +1,7 @@ package buildcraft.api; /** Allows a mod (or addon) to register networking packets in the message manager. */ -public interface IBuildCraftMod -{ +public interface IBuildCraftMod { /** @return The modid to use when registering this as a channel. */ String getModId(); } diff --git a/api/buildcraft/api/blocks/CustomPaintHelper.java b/api/buildcraft/api/blocks/CustomPaintHelper.java index 4fa536c..a73ae56 100644 --- a/api/buildcraft/api/blocks/CustomPaintHelper.java +++ b/api/buildcraft/api/blocks/CustomPaintHelper.java @@ -1,7 +1,7 @@ package buildcraft.api.blocks; -import buildcraft.api.core.BCLog; import buildcraft.api.core.BCDebugging; +import buildcraft.api.core.BCLog; import buildcraft.lib.misc.BlockUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -23,8 +23,7 @@ * Provides a simple way to paint a single core, iterating through all {@link ICustomPaintHandler}'s that are * registered for the core. */ -public enum CustomPaintHelper -{ +public enum CustomPaintHelper { INSTANCE; /* If you want to test your class-based rotation registration then add the system property @@ -38,10 +37,8 @@ public enum CustomPaintHelper * Registers a handler that will be called LAST for ALL blocks, if all other paint handlers have returned PASS or * none are registered for that core. */ - public void registerHandlerForAll(ICustomPaintHandler handler) - { - if (DEBUG) - { + public void registerHandlerForAll(ICustomPaintHandler handler) { + if (DEBUG) { BCLog.logger.info("[api.painting] Adding a paint handler for ALL blocks (" + handler.getClass() + ")"); } allHandlers.add(handler); @@ -50,16 +47,12 @@ public void registerHandlerForAll(ICustomPaintHandler handler) /** * Register's a paint handler for every class of a given core. */ - public void registerHandlerForAll(Class blockClass, ICustomPaintHandler handler) - { + public void registerHandlerForAll(Class blockClass, ICustomPaintHandler handler) { // for (Block block : Block.REGISTRY) - for (Block block : ForgeRegistries.BLOCKS.getValues()) - { + for (Block block : ForgeRegistries.BLOCKS.getValues()) { Class foundClass = block.getClass(); - if (blockClass.isAssignableFrom(foundClass)) - { - if (DEBUG) - { + if (blockClass.isAssignableFrom(foundClass)) { + if (DEBUG) { BCLog.logger.info("[api.painting] Found an assignable core " + block.getRegistryName() + " (" + foundClass + ") for " + blockClass); } registerHandlerInternal(block, handler); @@ -67,32 +60,25 @@ public void registerHandlerForAll(Class blockClass, ICustomPain } } - public void registerHandler(Block block, ICustomPaintHandler handler) - { - if (registerHandlerInternal(block, handler)) - { - if (DEBUG) - { + public void registerHandler(Block block, ICustomPaintHandler handler) { + if (registerHandlerInternal(block, handler)) { + if (DEBUG) { BCLog.logger.info("[api.painting] Setting a paint handler for core " + block.getRegistryName() + "(" + handler.getClass() + ")"); } } - else if (DEBUG) - { + else if (DEBUG) { BCLog.logger.info("[api.painting] Adding another paint handler for core " + block.getRegistryName() + "(" + handler.getClass() + ")"); } } - private boolean registerHandlerInternal(Block block, ICustomPaintHandler handler) - { - if (!handlers.containsKey(block)) - { + private boolean registerHandlerInternal(Block block, ICustomPaintHandler handler) { + if (!handlers.containsKey(block)) { List forBlock = Lists.newArrayList(); forBlock.add(handler); handlers.put(block, forBlock); return true; } - else - { + else { handlers.get(block).add(handler); return false; } @@ -101,51 +87,40 @@ private boolean registerHandlerInternal(Block block, ICustomPaintHandler handler /** * Attempts to paint a core at the given position. Basically iterates through all registered paint handlers. */ - public InteractionResult attemptPaintBlock(Level world, BlockPos pos, BlockState state, Vec3 hitPos, @Nullable Direction hitSide, @Nullable DyeColor paint) - { + public InteractionResult attemptPaintBlock(Level world, BlockPos pos, BlockState state, Vec3 hitPos, @Nullable Direction hitSide, @Nullable DyeColor paint) { Block block = state.getBlock(); - if (block instanceof ICustomPaintHandler) - { + if (block instanceof ICustomPaintHandler) { return ((ICustomPaintHandler) block).attemptPaint(world, pos, state, hitPos, hitSide, paint); } List custom = handlers.get(block); - if (custom == null || custom.isEmpty()) - { + if (custom == null || custom.isEmpty()) { return defaultAttemptPaint(world, pos, state, hitPos, hitSide, paint); } - for (ICustomPaintHandler handler : custom) - { + for (ICustomPaintHandler handler : custom) { InteractionResult result = handler.attemptPaint(world, pos, state, hitPos, hitSide, paint); - if (result != InteractionResult.PASS) - { + if (result != InteractionResult.PASS) { return result; } } return defaultAttemptPaint(world, pos, state, hitPos, hitSide, paint); } - private InteractionResult defaultAttemptPaint(Level world, BlockPos pos, BlockState state, Vec3 hitPos, Direction hitSide, @Nullable DyeColor paint) - { - for (ICustomPaintHandler handler : allHandlers) - { + private InteractionResult defaultAttemptPaint(Level world, BlockPos pos, BlockState state, Vec3 hitPos, Direction hitSide, @Nullable DyeColor paint) { + for (ICustomPaintHandler handler : allHandlers) { InteractionResult result = handler.attemptPaint(world, pos, state, hitPos, hitSide, paint); - if (result != InteractionResult.PASS) - { + if (result != InteractionResult.PASS) { return result; } } - if (paint == null) - { + if (paint == null) { return InteractionResult.FAIL; } Block b = state.getBlock(); // if (b.recolorBlock(world, pos, hitSide, paint)) - if (BlockUtil.recolorBlock(world, pos, hitSide, paint)) - { + if (BlockUtil.recolorBlock(world, pos, hitSide, paint)) { return InteractionResult.SUCCESS; } - else - { + else { return InteractionResult.FAIL; } } diff --git a/api/buildcraft/api/blocks/CustomRotationHelper.java b/api/buildcraft/api/blocks/CustomRotationHelper.java index 7d784c6..2000883 100644 --- a/api/buildcraft/api/blocks/CustomRotationHelper.java +++ b/api/buildcraft/api/blocks/CustomRotationHelper.java @@ -6,7 +6,6 @@ import com.google.common.collect.Maps; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.Registry; import net.minecraft.world.InteractionResult; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; @@ -16,8 +15,7 @@ import java.util.List; import java.util.Map; -public enum CustomRotationHelper -{ +public enum CustomRotationHelper { INSTANCE; /* If you want to test your class-based rotation registration then add the system property @@ -44,7 +42,8 @@ public void registerHandler(Block block, ICustomRotationHandler handler) { if (DEBUG) { BCLog.logger.info("[api.rotation] Setting a rotation handler for core " + block.getRegistryName()); } - } else if (DEBUG) { + } + else if (DEBUG) { BCLog.logger.info("[api.rotation] Adding another rotation handler for core " + block.getRegistryName()); } } @@ -55,7 +54,8 @@ private boolean registerHandlerInternal(Block block, ICustomRotationHandler hand forBlock.add(handler); handlers.put(block, forBlock); return true; - } else { + } + else { handlers.get(block).add(handler); return false; } diff --git a/api/buildcraft/api/blocks/ICustomPaintHandler.java b/api/buildcraft/api/blocks/ICustomPaintHandler.java index 064bded..4e9dc2e 100644 --- a/api/buildcraft/api/blocks/ICustomPaintHandler.java +++ b/api/buildcraft/api/blocks/ICustomPaintHandler.java @@ -12,11 +12,10 @@ /** Provides a way to paint blocks from any position. You can either implement this on a core, or register an instance * for a core with {@link CustomPaintHelper} */ -public interface ICustomPaintHandler -{ +public interface ICustomPaintHandler { /** Attempts to paint the given core. This can also only paint a specific part of the core (as the hit position is * given). - * + * * @param world The world that the core is contained within. * @param pos The position of the core. * @param state The current state of the core. diff --git a/api/buildcraft/api/blocks/ICustomRotationHandler.java b/api/buildcraft/api/blocks/ICustomRotationHandler.java index 3471a6a..8e04d3a 100644 --- a/api/buildcraft/api/blocks/ICustomRotationHandler.java +++ b/api/buildcraft/api/blocks/ICustomRotationHandler.java @@ -6,7 +6,6 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; -public interface ICustomRotationHandler -{ +public interface ICustomRotationHandler { InteractionResult attemptRotation(Level world, BlockPos pos, BlockState state, Direction sideWrenched); } diff --git a/api/buildcraft/api/boards/RedstoneBoardNBT.java b/api/buildcraft/api/boards/RedstoneBoardNBT.java index 1508afa..cddc0fc 100755 --- a/api/buildcraft/api/boards/RedstoneBoardNBT.java +++ b/api/buildcraft/api/boards/RedstoneBoardNBT.java @@ -33,7 +33,8 @@ public void createBoard(CompoundTag nbt) { public int getParameterNumber(CompoundTag nbt) { if (!nbt.contains("parameters")) { return 0; - } else { + } + else { return nbt.getList("parameters", Tag.TAG_COMPOUND).size(); } } diff --git a/api/buildcraft/api/boards/RedstoneBoardRegistry.java b/api/buildcraft/api/boards/RedstoneBoardRegistry.java index ba830f3..8dbd17b 100755 --- a/api/buildcraft/api/boards/RedstoneBoardRegistry.java +++ b/api/buildcraft/api/boards/RedstoneBoardRegistry.java @@ -14,7 +14,7 @@ public abstract class RedstoneBoardRegistry { public static RedstoneBoardRegistry instance; /** Register a redstone board type. - * + * * @param redstoneBoardNBT The RedstoneBoardNBT instance containing the board information. * @param microJoules MJ price of the board, in micro MJ. */ public abstract void registerBoardType(RedstoneBoardNBT redstoneBoardNBT, long microJoules); diff --git a/api/buildcraft/api/core/BCDebugging.java b/api/buildcraft/api/core/BCDebugging.java index 88dbed0..ef203ed 100644 --- a/api/buildcraft/api/core/BCDebugging.java +++ b/api/buildcraft/api/core/BCDebugging.java @@ -12,8 +12,7 @@ /** Provides a way to quickly enable or disable certain debug conditions via VM arguments or whether the client/server * is in a dev environment */ -public class BCDebugging -{ +public class BCDebugging { public enum DebugStatus { NONE, ENABLE, @@ -46,7 +45,8 @@ enum DebugLevel { Method getBlockEntity = Level.class.getDeclaredMethod("getBlockEntity", BlockPos.class); BCLog.logger.info("[debugger] Method found: Level.getBlockEntity = " + getBlockEntity); isDev = true; - } catch (Throwable ignored) { + } + catch (Throwable ignored) { // If it didn't find it then we aren't in a dev environment isDev = false; BCLog.logger.info("[debugger] Not a dev environment!"); @@ -58,21 +58,26 @@ enum DebugLevel { else if ("disable".equals(value)) { // let people disable the messages if they are in a dev environment but don't want messages. DEBUG_STATUS = DebugStatus.NONE; - } else if ("log".equals(value)) { + } + else if ("log".equals(value)) { // Some debugging options are more than just logging, so we will differentiate between them DEBUG_STATUS = DebugStatus.LOGGING_ONLY; - } else if (isDev) { + } + else if (isDev) { DEBUG_STATUS = DebugStatus.ENABLE; - } else { + } + else { // Most likely a built jar - don't spam people with info they probably don't need DEBUG_STATUS = DebugStatus.NONE; } if (DEBUG_STATUS == DebugStatus.ALL) { BCLog.logger.info("[debugger] Debugging automatically enabled for ALL of buildcraft. Prepare for log spam."); - } else if (DEBUG_STATUS == DebugStatus.LOGGING_ONLY) { + } + else if (DEBUG_STATUS == DebugStatus.LOGGING_ONLY) { BCLog.logger.info("[debugger] Debugging automatically enabled for some non-spammy parts of buildcraft."); - } else if (DEBUG_STATUS == DebugStatus.ENABLE) { + } + else if (DEBUG_STATUS == DebugStatus.ENABLE) { BCLog.logger.info("[debugger] Debugging not automatically enabled for all of buildcraft. Logging all possible debug options."); BCLog.logger.info(" To enable it for only logging messages add \"-Dbuildcraft.debug=log\" to your launch VM arguments"); BCLog.logger.info(" To enable it for ALL debugging \"-Dbuildcraft.debug=all\" to your launch VM arguments"); @@ -97,7 +102,8 @@ private static boolean shouldDebug(String option, DebugLevel type) { if ("false".equals(actual)) { BCLog.logger.info("[debugger] Debugging manually disabled for \"" + option + "\" (" + type + ")."); return false; - } else if ("true".equals(actual)) { + } + else if ("true".equals(actual)) { BCLog.logger.info("[debugger] Debugging enabled for \"" + option + "\" (" + type + ")."); return true; } @@ -108,7 +114,8 @@ private static boolean shouldDebug(String option, DebugLevel type) { if ("complex".equals(actual) || type.name.equals(actual)) { BCLog.logger.info("[debugger] Debugging enabled for \"" + option + "\" (" + type + ")."); return true; - } else if (DEBUG_STATUS != DebugStatus.NONE) { + } + else if (DEBUG_STATUS != DebugStatus.NONE) { StringBuilder log = new StringBuilder(); log.append("[debugger] To enable debugging for "); log.append(option); diff --git a/api/buildcraft/api/core/BCLog.java b/api/buildcraft/api/core/BCLog.java index 65d176a..7b892f7 100644 --- a/api/buildcraft/api/core/BCLog.java +++ b/api/buildcraft/api/core/BCLog.java @@ -8,12 +8,12 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public final class BCLog -{ +public final class BCLog { public static final Logger logger = LogManager.getLogger("BuildCraft"); /** Deactivate constructor */ - private BCLog() {} + private BCLog() { + } @Deprecated public static void logErrorAPI(String mod, Throwable error, Class classFile) { diff --git a/api/buildcraft/api/core/BuildCraftAPI.java b/api/buildcraft/api/core/BuildCraftAPI.java index 1bb2e1d..af9059e 100644 --- a/api/buildcraft/api/core/BuildCraftAPI.java +++ b/api/buildcraft/api/core/BuildCraftAPI.java @@ -19,55 +19,45 @@ import java.util.HashMap; import java.util.Set; -public final class BuildCraftAPI -{ +public final class BuildCraftAPI { public static IFakePlayerProvider fakePlayerProvider; public static final Set softBlocks = Sets.newHashSet(); public static final HashMap worldProperties = Maps.newHashMap(); /** Deactivate constructor */ - private BuildCraftAPI() - { + private BuildCraftAPI() { } - public static String getVersion() - { + public static String getVersion() { ModContainer container = ModList.get().getModContainerById("buildcraftlib").get(); - if (container != null) - { + if (container != null) { return container.getModInfo().getVersion().getQualifier(); } return "UNKNOWN VERSION"; } - public static IWorldProperty getWorldProperty(String name) - { + public static IWorldProperty getWorldProperty(String name) { return worldProperties.get(name); } - public static void registerWorldProperty(String name, IWorldProperty property) - { - if (worldProperties.containsKey(name)) - { + public static void registerWorldProperty(String name, IWorldProperty property) { + if (worldProperties.containsKey(name)) { BCLog.logger.warn("The WorldProperty key '" + name + "' is being overridden with " + property.getClass().getSimpleName() + "!"); } worldProperties.put(name, property); } - public static boolean isSoftBlock(Level world, BlockPos pos) - { + public static boolean isSoftBlock(Level world, BlockPos pos) { return worldProperties.get("soft").get(world, pos); } - public static ResourceLocation nameToResourceLocation(String name) - { + public static ResourceLocation nameToResourceLocation(String name) { if (name.indexOf(':') > 0) return new ResourceLocation(name); // ModContainer modContainer = ModLoader.get().activeModContainer(); ModContainer modContainer = ModLoadingContext.get().getActiveContainer(); // ModContainer modContainer = ModList.get().getModContainerById(BuildCraft.MOD_ID); - if (modContainer == null) - { + if (modContainer == null) { throw new IllegalStateException("Illegal recipe name " + name + ". Provide domain id to register it correctly."); } return new ResourceLocation(modContainer.getModId(), name); diff --git a/api/buildcraft/api/core/CapabilitiesHelper.java b/api/buildcraft/api/core/CapabilitiesHelper.java index 5786dbd..30dad14 100644 --- a/api/buildcraft/api/core/CapabilitiesHelper.java +++ b/api/buildcraft/api/core/CapabilitiesHelper.java @@ -20,8 +20,7 @@ * via the forge-recommended {@link CapabilityInject} route, or refer to the various fields in buildcraft api classes * containing the capability instances. */ -public class CapabilitiesHelper -{ +public class CapabilitiesHelper { // ################ // diff --git a/api/buildcraft/api/core/EnumPipePart.java b/api/buildcraft/api/core/EnumPipePart.java index 01ba7bf..e5bf41f 100644 --- a/api/buildcraft/api/core/EnumPipePart.java +++ b/api/buildcraft/api/core/EnumPipePart.java @@ -10,8 +10,7 @@ import java.util.Locale; import java.util.Map; -public enum EnumPipePart implements StringRepresentable -{ +public enum EnumPipePart implements StringRepresentable { DOWN(Direction.DOWN), UP(Direction.UP), NORTH(Direction.NORTH), @@ -39,7 +38,7 @@ public enum EnumPipePart implements StringRepresentable FACES = fromFacingArray(Direction.values()); // 1.18.2 HORIZONTALS -> private BY_2D_DATA // HORIZONTALS = fromFacingArray(Direction.HORIZONTALS); - HORIZONTALS = fromFacingArray(Direction.from2DDataValue(0),Direction.from2DDataValue(1),Direction.from2DDataValue(2),Direction.from2DDataValue(3)); + HORIZONTALS = fromFacingArray(Direction.from2DDataValue(0), Direction.from2DDataValue(1), Direction.from2DDataValue(2), Direction.from2DDataValue(3)); } @@ -121,7 +120,8 @@ public static EnumPipePart readFromNBT(Tag base) { StringTag nbtString = (StringTag) base; String string = nbtString.getAsString(); return nameMap.getOrDefault(string, CENTER); - } else { + } + else { byte ord = ((NumericTag) base).getAsByte(); if (ord < 0 || ord > 6) { return CENTER; diff --git a/api/buildcraft/api/core/IAreaProvider.java b/api/buildcraft/api/core/IAreaProvider.java index a42fb60..3cb7500 100644 --- a/api/buildcraft/api/core/IAreaProvider.java +++ b/api/buildcraft/api/core/IAreaProvider.java @@ -8,8 +8,7 @@ import net.minecraft.core.BlockPos; /** To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers. */ -public interface IAreaProvider -{ +public interface IAreaProvider { BlockPos min(); BlockPos max(); diff --git a/api/buildcraft/api/core/IConvertable.java b/api/buildcraft/api/core/IConvertable.java index dfb9458..3a5ae23 100644 --- a/api/buildcraft/api/core/IConvertable.java +++ b/api/buildcraft/api/core/IConvertable.java @@ -4,8 +4,7 @@ /** An object that can be converted into another type. Implementing this interface makes no guarantees that * {@link #convertTo(Class)} will actually return anything other than this or null. */ -public interface IConvertable -{ +public interface IConvertable { /** Attempts to convert this object to the given class. Returns this object if it is already an instance of the * given class, a separate object if it can be converted, or null if no conversion is possible. */ diff --git a/api/buildcraft/api/core/IEngineType.java b/api/buildcraft/api/core/IEngineType.java index ca82213..b871096 100644 --- a/api/buildcraft/api/core/IEngineType.java +++ b/api/buildcraft/api/core/IEngineType.java @@ -1,6 +1,5 @@ package buildcraft.api.core; -public interface IEngineType -{ +public interface IEngineType { String getItemModelLocation(); } diff --git a/api/buildcraft/api/core/IFakePlayerProvider.java b/api/buildcraft/api/core/IFakePlayerProvider.java index 4a56065..b7fad66 100755 --- a/api/buildcraft/api/core/IFakePlayerProvider.java +++ b/api/buildcraft/api/core/IFakePlayerProvider.java @@ -11,8 +11,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraftforge.common.util.FakePlayer; -public interface IFakePlayerProvider -{ +public interface IFakePlayerProvider { /** * Returns the generic buildcraft fake player. Note that you shouldn't use this anymore, as you should store the * UUID of the real player who created the core or entity that calls this. diff --git a/api/buildcraft/api/core/IFluidFilter.java b/api/buildcraft/api/core/IFluidFilter.java index 5920db8..7774892 100755 --- a/api/buildcraft/api/core/IFluidFilter.java +++ b/api/buildcraft/api/core/IFluidFilter.java @@ -6,8 +6,6 @@ import net.minecraftforge.fluids.FluidStack; -public interface IFluidFilter -{ - +public interface IFluidFilter { boolean matches(FluidStack fluid); } diff --git a/api/buildcraft/api/core/IFluidHandlerAdv.java b/api/buildcraft/api/core/IFluidHandlerAdv.java index fb8075c..f15b7d1 100644 --- a/api/buildcraft/api/core/IFluidHandlerAdv.java +++ b/api/buildcraft/api/core/IFluidHandlerAdv.java @@ -8,8 +8,7 @@ /** * A version of {@link IFluidHandler} that can drain a fluid that a fluid filter accepts. */ -public interface IFluidHandlerAdv extends IFluidHandler -{ +public interface IFluidHandlerAdv extends IFluidHandler { /** * Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. * diff --git a/api/buildcraft/api/core/IPathProvider.java b/api/buildcraft/api/core/IPathProvider.java index d2397e2..bf855a9 100644 --- a/api/buildcraft/api/core/IPathProvider.java +++ b/api/buildcraft/api/core/IPathProvider.java @@ -6,8 +6,7 @@ import java.util.List; /** To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers. */ -public interface IPathProvider -{ +public interface IPathProvider { /** @return The completed path. This should loop back onto itself (The last position is the same as the first * position) if you are {@link MapLocationType#PATH_REPEATING} */ List getPath(); diff --git a/api/buildcraft/api/core/IPlayerOwned.java b/api/buildcraft/api/core/IPlayerOwned.java index b710c4d..8aa80fe 100644 --- a/api/buildcraft/api/core/IPlayerOwned.java +++ b/api/buildcraft/api/core/IPlayerOwned.java @@ -3,7 +3,6 @@ import com.mojang.authlib.GameProfile; /** Defines an entity or tile that is owned by a specific player. */ -public interface IPlayerOwned -{ +public interface IPlayerOwned { GameProfile getOwner(); } diff --git a/api/buildcraft/api/core/IStackFilter.java b/api/buildcraft/api/core/IStackFilter.java index b84701d..aa72538 100644 --- a/api/buildcraft/api/core/IStackFilter.java +++ b/api/buildcraft/api/core/IStackFilter.java @@ -11,11 +11,10 @@ /** This interface provides a convenient means of dealing with entire classes of items without having to specify each * item individually. */ -public interface IStackFilter -{ +public interface IStackFilter { /** Check to see if a given stack matches this filter. - * + * * @param stack The stack to test. stack.isEmpty will always return false. * @return True if it does match, false otherwise. */ boolean matches(@Nonnull ItemStack stack); diff --git a/api/buildcraft/api/core/IWorldProperty.java b/api/buildcraft/api/core/IWorldProperty.java index 034786c..52ee68c 100755 --- a/api/buildcraft/api/core/IWorldProperty.java +++ b/api/buildcraft/api/core/IWorldProperty.java @@ -7,8 +7,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; -public interface IWorldProperty -{ +public interface IWorldProperty { boolean get(Level world, BlockPos pos); void clear(); diff --git a/api/buildcraft/api/core/IZone.java b/api/buildcraft/api/core/IZone.java index 50759a4..a09ca8c 100755 --- a/api/buildcraft/api/core/IZone.java +++ b/api/buildcraft/api/core/IZone.java @@ -10,8 +10,7 @@ import java.util.Random; /** Defines some volume in the world. This is not guaranteed to be fully connected to itself. */ -public interface IZone -{ +public interface IZone { /** Returns the smallest possible distance that the pos would have to be changed by in order for * {@link #contains(Vec3)} to return true. If the position is already inside then this will return 0 */ double distanceTo(BlockPos pos); diff --git a/api/buildcraft/api/core/SafeTimeTracker.java b/api/buildcraft/api/core/SafeTimeTracker.java index 80f9be7..6b87cb5 100644 --- a/api/buildcraft/api/core/SafeTimeTracker.java +++ b/api/buildcraft/api/core/SafeTimeTracker.java @@ -7,8 +7,7 @@ import net.minecraft.world.level.Level; /** Provides a way of tracking time in the world, without requiring manual ticking. */ -public class SafeTimeTracker -{ +public class SafeTimeTracker { private long lastMark = Long.MIN_VALUE; private long duration = -1; @@ -50,13 +49,15 @@ public boolean markTimeIfDelay(Level world, long delay) { if (currentTime < lastMark) { lastMark = currentTime; return false; - } else if (lastMark + delay + lastRandomDelay <= currentTime) { + } + else if (lastMark + delay + lastRandomDelay <= currentTime) { duration = currentTime - lastMark; lastMark = currentTime; lastRandomDelay = (int) (Math.random() * randomRange); return true; - } else { + } + else { return false; } } diff --git a/api/buildcraft/api/core/render/ISprite.java b/api/buildcraft/api/core/render/ISprite.java index 66637fe..0428a44 100644 --- a/api/buildcraft/api/core/render/ISprite.java +++ b/api/buildcraft/api/core/render/ISprite.java @@ -8,8 +8,7 @@ *

* IMPORTANT: Unlike Minecraft's {@link TextureAtlasSprite} this uses co-ordinates between 0 and 1, rather than 0 * and 16! */ -public interface ISprite -{ +public interface ISprite { /** Binds this sprites backing texture so that this sprite will be referenced when you use the results of * {@link #getInterpU(double)} and {@link #getInterpV(double)} */ void bindTexture(); diff --git a/api/buildcraft/api/crops/CropManager.java b/api/buildcraft/api/crops/CropManager.java index 53bc05a..227f75f 100644 --- a/api/buildcraft/api/crops/CropManager.java +++ b/api/buildcraft/api/crops/CropManager.java @@ -1,16 +1,16 @@ package buildcraft.api.crops; -import java.util.ArrayList; -import java.util.List; - +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import net.minecraft.core.NonNullList; -import net.minecraft.core.BlockPos; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; +import java.util.ArrayList; +import java.util.List; + public final class CropManager { private static List handlers = new ArrayList<>(); private static ICropHandler defaultHandler; diff --git a/api/buildcraft/api/crops/ICropHandler.java b/api/buildcraft/api/crops/ICropHandler.java index 199b036..1f76764 100644 --- a/api/buildcraft/api/crops/ICropHandler.java +++ b/api/buildcraft/api/crops/ICropHandler.java @@ -1,10 +1,10 @@ package buildcraft.api.crops; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import net.minecraft.core.NonNullList; -import net.minecraft.core.BlockPos; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; diff --git a/api/buildcraft/api/data/NbtSquishConstants.java b/api/buildcraft/api/data/NbtSquishConstants.java index 0295136..7f3d204 100644 --- a/api/buildcraft/api/data/NbtSquishConstants.java +++ b/api/buildcraft/api/data/NbtSquishConstants.java @@ -9,12 +9,11 @@ import java.io.DataOutput; import java.util.zip.GZIPInputStream; -public class NbtSquishConstants -{ +public class NbtSquishConstants { /** Default written NBT Tag type- this is provided by * {@link NbtIo#write(CompoundTag, DataOutput)} and * {@link NbtIo#read(DataInput, NbtAccounter)}. - * + * * Generally more suited to smaller NBT tags, and it writes fairly quickly. Can quickly use up a lot of space for * larger/more complex tags so it is recommended that you also pass it through a GZIP compressor to take up a much * smaller space. */ diff --git a/api/buildcraft/api/enums/EnumDecoratedBlock.java b/api/buildcraft/api/enums/EnumDecoratedBlock.java index 63348e9..5762d7c 100644 --- a/api/buildcraft/api/enums/EnumDecoratedBlock.java +++ b/api/buildcraft/api/enums/EnumDecoratedBlock.java @@ -4,8 +4,7 @@ import java.util.Locale; -public enum EnumDecoratedBlock implements StringRepresentable -{ +public enum EnumDecoratedBlock implements StringRepresentable { DESTROY(0), BLUEPRINT(10), TEMPLATE(10), diff --git a/api/buildcraft/api/enums/EnumEngineType.java b/api/buildcraft/api/enums/EnumEngineType.java index e788d1d..2c86ef4 100644 --- a/api/buildcraft/api/enums/EnumEngineType.java +++ b/api/buildcraft/api/enums/EnumEngineType.java @@ -9,8 +9,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -public enum EnumEngineType implements StringRepresentable, IEngineType -{ +public enum EnumEngineType implements StringRepresentable, IEngineType { WOOD("core", "wood"), STONE("energy", "stone"), IRON("energy", "iron"), @@ -29,33 +28,26 @@ public enum EnumEngineType implements StringRepresentable, IEngineType @OnlyIn(Dist.CLIENT) private TextureAtlasSprite particle; - EnumEngineType(String mod, String loc) - { + EnumEngineType(String mod, String loc) { unlocalizedTag = loc; resourceLocation = "buildcraft" + mod + ":blocks/engine/inv/" + loc; } @OnlyIn(Dist.CLIENT) - public void setModel(ModelHolderVariable model) - { + public void setModel(ModelHolderVariable model) { this.model = model; } @OnlyIn(Dist.CLIENT) - public ModelHolderVariable getModel() - { + public ModelHolderVariable getModel() { return model; } @OnlyIn(Dist.CLIENT) - public TextureAtlasSprite getPticle() - { - if (particle == null) - { - for (MutableQuad quad : model.getCutoutQuads()) - { - if (quad.getFace() == Direction.DOWN) - { + public TextureAtlasSprite getPticle() { + if (particle == null) { + for (MutableQuad quad : model.getCutoutQuads()) { + if (quad.getFace() == Direction.DOWN) { particle = quad.getSprite(); break; } @@ -65,21 +57,17 @@ public TextureAtlasSprite getPticle() } @Override - public String getItemModelLocation() - { + public String getItemModelLocation() { return resourceLocation; } @Override - public String getSerializedName() - { + public String getSerializedName() { return unlocalizedTag; } - public static EnumEngineType fromMeta(int meta) - { - if (meta < 0 || meta >= VALUES.length) - { + public static EnumEngineType fromMeta(int meta) { + if (meta < 0 || meta >= VALUES.length) { meta = 0; } return VALUES[meta]; diff --git a/api/buildcraft/api/enums/EnumExchangePart.java b/api/buildcraft/api/enums/EnumExchangePart.java index e3f23fb..13527b3 100644 --- a/api/buildcraft/api/enums/EnumExchangePart.java +++ b/api/buildcraft/api/enums/EnumExchangePart.java @@ -4,8 +4,7 @@ import java.util.Locale; -public enum EnumExchangePart implements StringRepresentable -{ +public enum EnumExchangePart implements StringRepresentable { START, MIDDLE, END; @@ -13,8 +12,7 @@ public enum EnumExchangePart implements StringRepresentable private final String lowerCaseName = name().toLowerCase(Locale.ROOT); @Override - public String getSerializedName() - { + public String getSerializedName() { return lowerCaseName; } } diff --git a/api/buildcraft/api/enums/EnumLaserTableType.java b/api/buildcraft/api/enums/EnumLaserTableType.java index ca0610a..7645a34 100644 --- a/api/buildcraft/api/enums/EnumLaserTableType.java +++ b/api/buildcraft/api/enums/EnumLaserTableType.java @@ -2,8 +2,7 @@ import net.minecraft.util.StringRepresentable; -public enum EnumLaserTableType implements StringRepresentable -{ +public enum EnumLaserTableType implements StringRepresentable { ASSEMBLY_TABLE, ADVANCED_CRAFTING_TABLE, INTEGRATION_TABLE, diff --git a/api/buildcraft/api/enums/EnumMachineState.java b/api/buildcraft/api/enums/EnumMachineState.java index 4d29931..a10dd85 100644 --- a/api/buildcraft/api/enums/EnumMachineState.java +++ b/api/buildcraft/api/enums/EnumMachineState.java @@ -4,8 +4,7 @@ import net.minecraft.util.StringRepresentable; import net.minecraft.world.level.block.state.BlockState; -public enum EnumMachineState implements StringRepresentable -{ +public enum EnumMachineState implements StringRepresentable { OFF, ON, DONE; diff --git a/api/buildcraft/api/enums/EnumOptionalSnapshotType.java b/api/buildcraft/api/enums/EnumOptionalSnapshotType.java index 4e12537..1cd0dc4 100644 --- a/api/buildcraft/api/enums/EnumOptionalSnapshotType.java +++ b/api/buildcraft/api/enums/EnumOptionalSnapshotType.java @@ -8,8 +8,7 @@ * Version of {@link EnumSnapshotType} with {@link EnumOptionalSnapshotType#NONE} value. * Shouldn't be used where it's possible to use {@link EnumSnapshotType}. */ -public enum EnumOptionalSnapshotType implements StringRepresentable -{ +public enum EnumOptionalSnapshotType implements StringRepresentable { NONE(null), TEMPLATE(EnumSnapshotType.TEMPLATE), BLUEPRINT(EnumSnapshotType.BLUEPRINT); diff --git a/api/buildcraft/api/enums/EnumPowerStage.java b/api/buildcraft/api/enums/EnumPowerStage.java index 399aa31..75f914c 100644 --- a/api/buildcraft/api/enums/EnumPowerStage.java +++ b/api/buildcraft/api/enums/EnumPowerStage.java @@ -4,8 +4,7 @@ import java.util.Locale; -public enum EnumPowerStage implements StringRepresentable -{ +public enum EnumPowerStage implements StringRepresentable { BLUE, GREEN, YELLOW, diff --git a/api/buildcraft/api/enums/EnumRedstoneChipset.java b/api/buildcraft/api/enums/EnumRedstoneChipset.java index 480a232..b10c886 100644 --- a/api/buildcraft/api/enums/EnumRedstoneChipset.java +++ b/api/buildcraft/api/enums/EnumRedstoneChipset.java @@ -10,8 +10,7 @@ import java.util.Locale; //public enum EnumRedstoneChipset implements IStringSerializable -public enum EnumRedstoneChipset implements StringRepresentable -{ +public enum EnumRedstoneChipset implements StringRepresentable { RED, IRON, GOLD, @@ -20,12 +19,10 @@ public enum EnumRedstoneChipset implements StringRepresentable private final String name = name().toLowerCase(Locale.ROOT); - public ItemStack getStack(int stackSize) - { + public ItemStack getStack(int stackSize) { // Item chipset = BCItems.Silicon.REDSTONE_CHIPSET; RegistryObject chipset = BCSiliconItems.chipsetRedstone; - if (chipset == null) - { + if (chipset == null) { return ItemStack.EMPTY; } // ordinal() -> meta @@ -35,8 +32,7 @@ public ItemStack getStack(int stackSize) // 3 石英 // 4 钻石 // return new ItemStack(chipset, stackSize, ordinal()); - switch (this) - { + switch (this) { case RED: return new ItemStack(BCSiliconItems.chipsetRedstone.get(), stackSize); case IRON: @@ -52,26 +48,21 @@ public ItemStack getStack(int stackSize) } } - public ItemStack getStack() - { + public ItemStack getStack() { return getStack(1); } - public static EnumRedstoneChipset fromStack(ItemStack stack) - { + public static EnumRedstoneChipset fromStack(ItemStack stack) { // if (stack == null) - if (stack == null || stack.getItem().getClass() != ItemRedstoneChipset.class) - { + if (stack == null || stack.getItem().getClass() != ItemRedstoneChipset.class) { return RED; } // return fromOrdinal(stack.getMetadata()); return ((ItemRedstoneChipset) stack.getItem()).type; } - public static EnumRedstoneChipset fromOrdinal(int ordinal) - { - if (ordinal < 0 || ordinal >= values().length) - { + public static EnumRedstoneChipset fromOrdinal(int ordinal) { + if (ordinal < 0 || ordinal >= values().length) { return RED; } return values()[ordinal]; @@ -79,8 +70,7 @@ public static EnumRedstoneChipset fromOrdinal(int ordinal) @Override // public String getName() - public String getSerializedName() - { + public String getSerializedName() { return name; } } diff --git a/api/buildcraft/api/enums/EnumSpring.java b/api/buildcraft/api/enums/EnumSpring.java index 8fe13b8..22c90a6 100644 --- a/api/buildcraft/api/enums/EnumSpring.java +++ b/api/buildcraft/api/enums/EnumSpring.java @@ -9,8 +9,7 @@ import java.util.Locale; import java.util.function.BiFunction; -public enum EnumSpring implements StringRepresentable -{ +public enum EnumSpring implements StringRepresentable { WATER(5, -1, Blocks.WATER.defaultBlockState()), OIL(6000, 8, null); // Set in BuildCraftEnergy @@ -19,7 +18,7 @@ public enum EnumSpring implements StringRepresentable public final int tickRate, chance; public BlockState liquidBlock; public boolean canGen = true; -// public Supplier tileConstructor; + // public Supplier tileConstructor; public BiFunction tileConstructor; private final String lowerCaseName = name().toLowerCase(Locale.ROOT); diff --git a/api/buildcraft/api/events/BlockInteractionEvent.java b/api/buildcraft/api/events/BlockInteractionEvent.java index e00cdcc..a17f7a1 100644 --- a/api/buildcraft/api/events/BlockInteractionEvent.java +++ b/api/buildcraft/api/events/BlockInteractionEvent.java @@ -11,8 +11,7 @@ import net.minecraftforge.eventbus.api.Event; @Cancelable -public class BlockInteractionEvent extends Event -{ +public class BlockInteractionEvent extends Event { public final Player player; public final BlockState state; diff --git a/api/buildcraft/api/events/BlockPlacedDownEvent.java b/api/buildcraft/api/events/BlockPlacedDownEvent.java index da53618..71302e5 100644 --- a/api/buildcraft/api/events/BlockPlacedDownEvent.java +++ b/api/buildcraft/api/events/BlockPlacedDownEvent.java @@ -11,8 +11,7 @@ import net.minecraftforge.eventbus.api.Event; @Cancelable -public class BlockPlacedDownEvent extends Event -{ +public class BlockPlacedDownEvent extends Event { public final Player player; public final BlockState state; public final BlockPos pos; diff --git a/api/buildcraft/api/events/PipePlacedEvent.java b/api/buildcraft/api/events/PipePlacedEvent.java index 64ba625..40163ec 100644 --- a/api/buildcraft/api/events/PipePlacedEvent.java +++ b/api/buildcraft/api/events/PipePlacedEvent.java @@ -9,8 +9,7 @@ import net.minecraft.world.item.Item; import net.minecraftforge.eventbus.api.Event; -public class PipePlacedEvent extends Event -{ +public class PipePlacedEvent extends Event { public Player player; public Item pipeType; public BlockPos pos; diff --git a/api/buildcraft/api/events/RobotEvent.java b/api/buildcraft/api/events/RobotEvent.java index 43604d5..7c01008 100644 --- a/api/buildcraft/api/events/RobotEvent.java +++ b/api/buildcraft/api/events/RobotEvent.java @@ -10,8 +10,7 @@ import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; -public abstract class RobotEvent extends Event -{ +public abstract class RobotEvent extends Event { public final EntityRobotBase robot; public RobotEvent(EntityRobotBase robot) { diff --git a/api/buildcraft/api/events/RobotPlacementEvent.java b/api/buildcraft/api/events/RobotPlacementEvent.java index 7de1b91..5494229 100644 --- a/api/buildcraft/api/events/RobotPlacementEvent.java +++ b/api/buildcraft/api/events/RobotPlacementEvent.java @@ -9,8 +9,7 @@ import net.minecraftforge.eventbus.api.Event; @Cancelable -public class RobotPlacementEvent extends Event -{ +public class RobotPlacementEvent extends Event { public Player player; public String robotProgram; diff --git a/api/buildcraft/api/facades/FacadeAPI.java b/api/buildcraft/api/facades/FacadeAPI.java index 73f8d79..e546df4 100644 --- a/api/buildcraft/api/facades/FacadeAPI.java +++ b/api/buildcraft/api/facades/FacadeAPI.java @@ -9,8 +9,7 @@ import net.minecraftforge.fml.InterModComms; import net.minecraftforge.registries.RegistryObject; -public final class FacadeAPI -{ +public final class FacadeAPI { public static final String IMC_MOD_TARGET = "buildcraftsilicon"; public static final String IMC_FACADE_DISABLE = "facade_disable_block"; public static final String IMC_FACADE_CUSTOM = "facade_custom_map_block_item"; @@ -18,35 +17,31 @@ public final class FacadeAPI public static final String NBT_CUSTOM_BLOCK_META = "block_meta"; public static final String NBT_CUSTOM_ITEM_STACK = "item_stack"; -// public static IFacadeItem facadeItem; + // public static IFacadeItem facadeItem; // public static RegistryObject facadeItem; public static RegistryObject facadeItem; public static IFacadeRegistry registry; - private FacadeAPI() - { + private FacadeAPI() { } - public static void disableBlock(Block block) - { + public static void disableBlock(Block block) { // FMLInterModComms.sendMessage(IMC_MOD_TARGET, IMC_FACADE_DISABLE, block.getRegistryName()); - InterModComms.sendTo(IMC_MOD_TARGET, IMC_FACADE_DISABLE, ()->block.getRegistryName()); + InterModComms.sendTo(IMC_MOD_TARGET, IMC_FACADE_DISABLE, () -> block.getRegistryName()); } - public static void mapStateToStack(BlockState state, ItemStack stack) - { + public static void mapStateToStack(BlockState state, ItemStack stack) { CompoundTag nbt = new CompoundTag(); nbt.putString(NBT_CUSTOM_BLOCK_REG_KEY, state.getBlock().getRegistryName().toString()); // nbt.putInt(NBT_CUSTOM_BLOCK_META, state.getBlock().getMetaFromState(state)); nbt.put(NBT_CUSTOM_BLOCK_META, NbtUtils.writeBlockState(state)); nbt.put(NBT_CUSTOM_ITEM_STACK, stack.serializeNBT()); // FMLInterModComms.sendMessage(IMC_MOD_TARGET, IMC_FACADE_CUSTOM, nbt); - InterModComms.sendTo(IMC_MOD_TARGET, IMC_FACADE_CUSTOM, ()->nbt); + InterModComms.sendTo(IMC_MOD_TARGET, IMC_FACADE_CUSTOM, () -> nbt); } - public static boolean isFacadeMessageId(String id) - { + public static boolean isFacadeMessageId(String id) { return IMC_FACADE_CUSTOM.equals(id) // || IMC_FACADE_DISABLE.equals(id); } diff --git a/api/buildcraft/api/facades/IFacadeRegistry.java b/api/buildcraft/api/facades/IFacadeRegistry.java index c9cb903..b861a71 100644 --- a/api/buildcraft/api/facades/IFacadeRegistry.java +++ b/api/buildcraft/api/facades/IFacadeRegistry.java @@ -14,6 +14,6 @@ public interface IFacadeRegistry { IFacade createPhasedFacade(IFacadePhasedState[] states, boolean isHollow); default IFacade createBasicFacade(IFacadeState state, boolean isHollow) { - return createPhasedFacade(new IFacadePhasedState[] { createPhasedState(state, null) }, isHollow); + return createPhasedFacade(new IFacadePhasedState[]{createPhasedState(state, null)}, isHollow); } } diff --git a/api/buildcraft/api/filler/IFilledTemplate.java b/api/buildcraft/api/filler/IFilledTemplate.java index f9ef05c..2ed94c1 100644 --- a/api/buildcraft/api/filler/IFilledTemplate.java +++ b/api/buildcraft/api/filler/IFilledTemplate.java @@ -6,8 +6,7 @@ /** * Use methods of the interface as much as possible, implementation can do optimizations */ -public interface IFilledTemplate -{ +public interface IFilledTemplate { BlockPos getSize(); default BlockPos getMax() { diff --git a/api/buildcraft/api/filler/IFillerPatternShape.java b/api/buildcraft/api/filler/IFillerPatternShape.java index 0b82f85..95d26ae 100644 --- a/api/buildcraft/api/filler/IFillerPatternShape.java +++ b/api/buildcraft/api/filler/IFillerPatternShape.java @@ -22,8 +22,8 @@ public interface IFillerPatternShape extends IFillerPattern { @Override default IFilledTemplate createTemplate(IFillerStatementContainer filler, IStatementParameter[] params) { IFilledTemplate template = FillerManager.registry.createFilledTemplate( - filler.getBox().min(), - filler.getBox().size() + filler.getBox().min(), + filler.getBox().size() ); if (!fillTemplate(template, params)) { return null; diff --git a/api/buildcraft/api/fuels/BuildcraftFuelRegistry.java b/api/buildcraft/api/fuels/BuildcraftFuelRegistry.java index 545ac3d..107b26a 100644 --- a/api/buildcraft/api/fuels/BuildcraftFuelRegistry.java +++ b/api/buildcraft/api/fuels/BuildcraftFuelRegistry.java @@ -8,5 +8,6 @@ public final class BuildcraftFuelRegistry { public static IFuelManager fuel; public static ICoolantManager coolant; - private BuildcraftFuelRegistry() {} + private BuildcraftFuelRegistry() { + } } diff --git a/api/buildcraft/api/fuels/EnumCoolantType.java b/api/buildcraft/api/fuels/EnumCoolantType.java index e301862..e1256a6 100644 --- a/api/buildcraft/api/fuels/EnumCoolantType.java +++ b/api/buildcraft/api/fuels/EnumCoolantType.java @@ -3,19 +3,16 @@ import java.util.Locale; // Calen -public enum EnumCoolantType -{ +public enum EnumCoolantType { FLUID, SOLID, ; - public String getlowerName() - { + public String getlowerName() { return this.name().toLowerCase(Locale.ROOT); } - public static EnumCoolantType byName(String name) - { + public static EnumCoolantType byName(String name) { return valueOf(name.toUpperCase(Locale.ROOT)); } } diff --git a/api/buildcraft/api/fuels/ICoolant.java b/api/buildcraft/api/fuels/ICoolant.java index a5392e8..ac3fa24 100644 --- a/api/buildcraft/api/fuels/ICoolant.java +++ b/api/buildcraft/api/fuels/ICoolant.java @@ -12,54 +12,47 @@ import net.minecraft.world.level.Level; import net.minecraftforge.fluids.FluidStack; -public interface ICoolant extends Recipe -{ +public interface ICoolant extends Recipe { public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.ENERGY.getModId(), "coolant"); public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); EnumCoolantType getCoolantType(); + FluidStack getFluid(); @Override - default boolean matches(Container inv, Level world) - { + default boolean matches(Container inv, Level world) { return false; } @Override - default ItemStack assemble(Container inv) - { + default ItemStack assemble(Container inv) { return StackUtil.EMPTY; } @Override - default boolean canCraftInDimensions(int width, int height) - { + default boolean canCraftInDimensions(int width, int height) { return true; } @Override - default ItemStack getResultItem() - { + default ItemStack getResultItem() { return StackUtil.EMPTY; } @Override - default boolean isSpecial() - { + default boolean isSpecial() { return true; } @Override - default RecipeSerializer getSerializer() - { + default RecipeSerializer getSerializer() { return CoolantRecipeSerializer.INSTANCE; } @Override - default RecipeType getType() - { + default RecipeType getType() { return TYPE; } } diff --git a/api/buildcraft/api/fuels/ICoolantManager.java b/api/buildcraft/api/fuels/ICoolantManager.java index dc13799..4c11a7e 100644 --- a/api/buildcraft/api/fuels/ICoolantManager.java +++ b/api/buildcraft/api/fuels/ICoolantManager.java @@ -14,39 +14,37 @@ import java.util.Collection; -public interface ICoolantManager -{ -// IFluidCoolant addCoolant(IFluidCoolant coolant); +public interface ICoolantManager { + // IFluidCoolant addCoolant(IFluidCoolant coolant); IFluidCoolant addUnregisteredFluidCoolant(IFluidCoolant coolant); // IFluidCoolant addCoolant(FluidStack fluid, float degreesCoolingPerMb); IFluidCoolant addCoolant(ResourceLocation id, FluidStack fluid, float degreesCoolingPerMb); // default IFluidCoolant addCoolant(Fluid fluid, float degreesCoolingPerMb) - default IFluidCoolant addCoolant(ResourceLocation id, Fluid fluid, float degreesCoolingPerMb) - { + default IFluidCoolant addCoolant(ResourceLocation id, Fluid fluid, float degreesCoolingPerMb) { // return addCoolant(new FluidStack(fluid, 1), degreesCoolingPerMb); return addCoolant(id, new FluidStack(fluid, 1), degreesCoolingPerMb); } -// ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); + // ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); ISolidCoolant addUnregisteredSolidCoolant(ISolidCoolant solidCoolant); // ISolidCoolant addSolidCoolant(ItemStack solid, FluidStack fluid, float multiplier); ISolidCoolant addSolidCoolant(ResourceLocation id, ItemStack solid, FluidStack fluid, float multiplier); -// Collection getCoolants(); + // Collection getCoolants(); Collection getCoolants(Level world); -// Collection getSolidCoolants(); + // Collection getSolidCoolants(); Collection getSolidCoolants(Level world); -// IFluidCoolant getCoolant(FluidStack fluid); + // IFluidCoolant getCoolant(FluidStack fluid); IFluidCoolant getCoolant(Level world, FluidStack fluid); -// float getDegreesPerMb(FluidStack fluid, float heat); + // float getDegreesPerMb(FluidStack fluid, float heat); float getDegreesPerMb(Level world, FluidStack fluid, float heat); -// ISolidCoolant getSolidCoolant(ItemStack solid); + // ISolidCoolant getSolidCoolant(ItemStack solid); ISolidCoolant getSolidCoolant(Level world, ItemStack solid); } diff --git a/api/buildcraft/api/fuels/IFluidCoolant.java b/api/buildcraft/api/fuels/IFluidCoolant.java index 3442e1c..7b6c6ea 100644 --- a/api/buildcraft/api/fuels/IFluidCoolant.java +++ b/api/buildcraft/api/fuels/IFluidCoolant.java @@ -11,13 +11,13 @@ // Calen: ICoolant 1.12.2 -> IFluidCoolant 1.18.2 // 1.18.2 new class ICoolant super ICoolant, IFluidCoolant //public interface ICoolant -public interface IFluidCoolant extends ICoolant -{ +public interface IFluidCoolant extends ICoolant { boolean matchesFluid(FluidStack fluid); /** @param fluid * @param heat * @return 0 if the input fluid provides no cooling, or a value greater than 0 if it does. */ float getDegreesCoolingPerMB(FluidStack fluid, float heat); + float getDegreesCoolingPerMB(); } diff --git a/api/buildcraft/api/fuels/IFuel.java b/api/buildcraft/api/fuels/IFuel.java index 240b56f..d238aec 100644 --- a/api/buildcraft/api/fuels/IFuel.java +++ b/api/buildcraft/api/fuels/IFuel.java @@ -17,8 +17,7 @@ import net.minecraftforge.fluids.FluidStack; //public interface IFuel -public interface IFuel extends Recipe -{ +public interface IFuel extends Recipe { public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.ENERGY.getModId(), "fuel"); public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); @@ -33,39 +32,33 @@ public interface IFuel extends Recipe long getPowerPerCycle(); @Override - default boolean matches(Container inv, Level world) - { + default boolean matches(Container inv, Level world) { return false; } @Override - default ItemStack assemble(Container inv) - { + default ItemStack assemble(Container inv) { return StackUtil.EMPTY; } @Override - default boolean canCraftInDimensions(int width, int height) - { + default boolean canCraftInDimensions(int width, int height) { return true; } @Override - default ItemStack getResultItem() - { + default ItemStack getResultItem() { return StackUtil.EMPTY; } @Override - default boolean isSpecial() - { + default boolean isSpecial() { return true; } // Calen @Override - default RecipeType getType() - { + default RecipeType getType() { return TYPE; } diff --git a/api/buildcraft/api/fuels/IFuelManager.java b/api/buildcraft/api/fuels/IFuelManager.java index 55b5ed5..d9da115 100644 --- a/api/buildcraft/api/fuels/IFuelManager.java +++ b/api/buildcraft/api/fuels/IFuelManager.java @@ -13,8 +13,7 @@ import java.util.Collection; -public interface IFuelManager -{ +public interface IFuelManager { // F addFuel(F fuel); F addUnregisteredFuel(F fuel); @@ -22,8 +21,7 @@ public interface IFuelManager IFuel addUnregisteredFuel(ResourceLocation id, FluidStack fluid, long powerPerCycle, int totalBurningTime); // default IFuel addFuel(Fluid fluid, long powerPerCycle, int totalBurningTime) - default IFuel addUnregisteredFuel(ResourceLocation id, Fluid fluid, long powerPerCycle, int totalBurningTime) - { + default IFuel addUnregisteredFuel(ResourceLocation id, Fluid fluid, long powerPerCycle, int totalBurningTime) { // return addFuel(new FluidStack(fluid, 1), powerPerCycle, totalBurningTime); return addUnregisteredFuel(id, new FluidStack(fluid, 1), powerPerCycle, totalBurningTime); } @@ -39,8 +37,7 @@ default IFuel addUnregisteredFuel(ResourceLocation id, Fluid fluid, long powerPe * @param residue The residue fluidstack, per bucket of the original fuel. */ // default IDirtyFuel addDirtyFuel(Fluid fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) - default IDirtyFuel addUnregisteredDirtyFuel(ResourceLocation id, Fluid fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) - { + default IDirtyFuel addUnregisteredDirtyFuel(ResourceLocation id, Fluid fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) { // return addDirtyFuel(new FluidStack(fuel, 1), powerPerCycle, totalBurningTime, residue); return addUnregisteredDirtyFuel(id, new FluidStack(fuel, 1), powerPerCycle, totalBurningTime, residue); } @@ -51,8 +48,7 @@ default IDirtyFuel addUnregisteredDirtyFuel(ResourceLocation id, Fluid fuel, lon // IFuel getFuel(FluidStack fluid); IFuel getFuel(Level world, FluidStack fluid); - interface IDirtyFuel extends IFuel - { + interface IDirtyFuel extends IFuel { /** * @return The residue fluidstack, per bucket of original fuel. */ diff --git a/api/buildcraft/api/fuels/ISolidCoolant.java b/api/buildcraft/api/fuels/ISolidCoolant.java index 6554830..2d3ef19 100644 --- a/api/buildcraft/api/fuels/ISolidCoolant.java +++ b/api/buildcraft/api/fuels/ISolidCoolant.java @@ -9,8 +9,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -public interface ISolidCoolant extends ICoolant -{ +public interface ISolidCoolant extends ICoolant { FluidStack getFluidFromSolidCoolant(ItemStack stack); // Calen diff --git a/api/buildcraft/api/imc/BcImcMessage.java b/api/buildcraft/api/imc/BcImcMessage.java index b417564..2ef0c40 100644 --- a/api/buildcraft/api/imc/BcImcMessage.java +++ b/api/buildcraft/api/imc/BcImcMessage.java @@ -6,36 +6,30 @@ import javax.annotation.Nonnull; // Calen: from 1.12.2 forge -public class BcImcMessage -{ +public class BcImcMessage { @Nonnull public final String key; @Nonnull private final Object value; - public BcImcMessage(@Nonnull String key, @Nonnull Object value) - { + public BcImcMessage(@Nonnull String key, @Nonnull Object value) { this.key = key; this.value = value; } - public ResourceLocation getResourceLocationValue() - { + public ResourceLocation getResourceLocationValue() { return (ResourceLocation) value; } - public CompoundTag getNBTValue() - { + public CompoundTag getNBTValue() { return (CompoundTag) value; } - public boolean isNBTMessage() - { + public boolean isNBTMessage() { return CompoundTag.class.isAssignableFrom(getMessageType()); } - public Class getMessageType() - { + public Class getMessageType() { return value.getClass(); } } \ No newline at end of file diff --git a/api/buildcraft/api/inventory/IItemTransactor.java b/api/buildcraft/api/inventory/IItemTransactor.java index 87c2d2b..7265568 100644 --- a/api/buildcraft/api/inventory/IItemTransactor.java +++ b/api/buildcraft/api/inventory/IItemTransactor.java @@ -18,7 +18,7 @@ public interface IItemTransactor { /** Similar to {@link #insert(ItemStack, boolean, boolean)} but probably be more efficient at inserting lots of * items. - * + * * @param stacks The stacks to insert. Must not be null! * @param simulate If true then the in-world state of this will not be changed. * @return The overflow stacks. Will be an empty list if all of it was accepted. */ @@ -34,7 +34,7 @@ default NonNullList insert(NonNullList stacks, boolean sim } /** Extracts a number of items that match the given filter - * + * * @param filter The filter that MUST be met by the extracted stack. Null means no filter - it can be any item. * @param min The minimum number of items to extract, or 0 if not enough items can be extracted * @param max The maximum number of items to extract. diff --git a/api/buildcraft/api/items/FluidItemDrops.java b/api/buildcraft/api/items/FluidItemDrops.java index 0bf4877..a9bb410 100644 --- a/api/buildcraft/api/items/FluidItemDrops.java +++ b/api/buildcraft/api/items/FluidItemDrops.java @@ -7,8 +7,7 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.registries.RegistryObject; -public class FluidItemDrops -{ +public class FluidItemDrops { public static RegistryObject item; public static void addFluidDrops(NonNullList toDrop, FluidStack... fluids) { diff --git a/api/buildcraft/api/items/IItemFluidShard.java b/api/buildcraft/api/items/IItemFluidShard.java index 2f1df7d..a21a68e 100644 --- a/api/buildcraft/api/items/IItemFluidShard.java +++ b/api/buildcraft/api/items/IItemFluidShard.java @@ -6,7 +6,6 @@ import javax.annotation.Nullable; -public interface IItemFluidShard -{ +public interface IItemFluidShard { void addFluidDrops(NonNullList toDrop, @Nullable FluidStack fluid); } diff --git a/api/buildcraft/api/items/IMapLocation.java b/api/buildcraft/api/items/IMapLocation.java index 080103e..1185706 100644 --- a/api/buildcraft/api/items/IMapLocation.java +++ b/api/buildcraft/api/items/IMapLocation.java @@ -36,31 +36,31 @@ public void setToStack(@Nonnull ItemStack stack) { } /** This function can be used for SPOT types. - * + * * @param stack * @return The point representing the map location. */ BlockPos getPoint(@Nonnull ItemStack stack); /** This function can be used for SPOT and AREA types. - * + * * @param stack * @return The box representing the map location. */ IBox getBox(@Nonnull ItemStack stack); /** This function can be used for SPOT, AREA and ZONE types. The PATH type needs to be handled separately. - * + * * @param stack * @return An IZone representing the map location - also an instance of IBox for SPOT and AREA types. */ IZone getZone(@Nonnull ItemStack stack); /** This function can be used for SPOT and PATH types. - * + * * @param stack * @return A list of BlockPoses representing the path the Map Location stores. */ List getPath(@Nonnull ItemStack stack); /** This function can be used for SPOT types only. - * + * * @param stack * @return The side of the spot. */ Direction getPointSide(@Nonnull ItemStack stack); diff --git a/api/buildcraft/api/items/INamedItem.java b/api/buildcraft/api/items/INamedItem.java index 4f220f9..eafa7f6 100644 --- a/api/buildcraft/api/items/INamedItem.java +++ b/api/buildcraft/api/items/INamedItem.java @@ -1,13 +1,11 @@ package buildcraft.api.items; -import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import javax.annotation.Nonnull; -public interface INamedItem -{ -// Component getName(@Nonnull ItemStack stack); +public interface INamedItem { + // Component getName(@Nonnull ItemStack stack); String getName_INamedItem(@Nonnull ItemStack stack); boolean setName(@Nonnull ItemStack stack, String name); diff --git a/api/buildcraft/api/lists/ListMatchHandler.java b/api/buildcraft/api/lists/ListMatchHandler.java index bd117c7..86e5a03 100644 --- a/api/buildcraft/api/lists/ListMatchHandler.java +++ b/api/buildcraft/api/lists/ListMatchHandler.java @@ -18,7 +18,7 @@ public enum Type { public abstract boolean isValidSource(Type type, @Nonnull ItemStack stack); /** Get custom client examples. - * + * * @param type * @param stack * @return A List (even empty!) if the examples satisfy this handler, null if iteration and .matches should be used diff --git a/api/buildcraft/api/mj/ILaserTarget.java b/api/buildcraft/api/mj/ILaserTarget.java index 781a8a4..981c1db 100644 --- a/api/buildcraft/api/mj/ILaserTarget.java +++ b/api/buildcraft/api/mj/ILaserTarget.java @@ -4,14 +4,11 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.mj; -import java.lang.annotation.Inherited; - /** This interface should be defined by any Tile which wants to receive power from BuildCraft lasers. * * The respective Block MUST implement ILaserTargetBlock! */ //@ILaserTargetAnnotation // Calen -public interface ILaserTarget -{ +public interface ILaserTarget { /** Returns The amount of power this target currently needs. * diff --git a/api/buildcraft/api/mj/ILaserTargetBlock.java b/api/buildcraft/api/mj/ILaserTargetBlock.java index 9366b66..3e511f7 100644 --- a/api/buildcraft/api/mj/ILaserTargetBlock.java +++ b/api/buildcraft/api/mj/ILaserTargetBlock.java @@ -7,7 +7,6 @@ /** This is a marker interface for laser targets. Implement it on your Block. * * It is used by BuildCraft Lasers for optimization purposes. */ -public interface ILaserTargetBlock -{ +public interface ILaserTargetBlock { } diff --git a/api/buildcraft/api/mj/IMjConnector.java b/api/buildcraft/api/mj/IMjConnector.java index b5670fc..713599d 100644 --- a/api/buildcraft/api/mj/IMjConnector.java +++ b/api/buildcraft/api/mj/IMjConnector.java @@ -5,11 +5,10 @@ /** Signifies that this should visibly connect to other Mj handling entities/tiles. This should NEVER be the tile * entity, but an encapsulated class that refers back to it. Use {@link MjAPI#CAP_CONNECTOR} to access * this. */ -public interface IMjConnector -{ +public interface IMjConnector { /** Checks to see if this connector can connect to the other connector. By default this should check that the other * connector is the same power system. - * + * * @param other * @return */ boolean canConnect(@Nonnull IMjConnector other); diff --git a/api/buildcraft/api/mj/IMjEffectManager.java b/api/buildcraft/api/mj/IMjEffectManager.java index 62780a5..a2b009e 100644 --- a/api/buildcraft/api/mj/IMjEffectManager.java +++ b/api/buildcraft/api/mj/IMjEffectManager.java @@ -6,8 +6,7 @@ /** Various effects for showing power loss visibly, and for large amounts of power, causes some damage to nearby * entities. */ -public interface IMjEffectManager -{ +public interface IMjEffectManager { void createPowerLossEffect(Level world, Vec3 center, long microJoulesLost); void createPowerLossEffect(Level world, Vec3 center, Direction direction, long microJoulesLost); diff --git a/api/buildcraft/api/mj/IMjPassiveProvider.java b/api/buildcraft/api/mj/IMjPassiveProvider.java index 55b33c6..e6df834 100644 --- a/api/buildcraft/api/mj/IMjPassiveProvider.java +++ b/api/buildcraft/api/mj/IMjPassiveProvider.java @@ -4,7 +4,7 @@ * engine). Power can be extracted from this by powered wooden kinesis pipes, for example. */ public interface IMjPassiveProvider extends IMjConnector { /** Attempts to extract power from this provider - * + * * @param simulate * @return Either 0, min, max, or a value between min and max. */ long extractPower(long min, long max, boolean simulate); diff --git a/api/buildcraft/api/mj/IMjReceiver.java b/api/buildcraft/api/mj/IMjReceiver.java index a8cecd7..750640e 100644 --- a/api/buildcraft/api/mj/IMjReceiver.java +++ b/api/buildcraft/api/mj/IMjReceiver.java @@ -11,10 +11,10 @@ public interface IMjReceiver extends IMjConnector { *

  • Store all power in something like an {@link MjBattery} for later usage. *
  • Refuse all power (if you have no more work to do or your {@link MjBattery} is full). * - * + * * Note that callers are NOT expected to call {@link #canReceive()} before calling this - implementors should check * all of the conditions in {@link #canReceive()} before accepting power. - * + * * @param microJoules The number of micro joules to add. * @param simulate If true then just pretend you received power- don't actually change any of your internal state. * @return The excess power. */ @@ -22,7 +22,7 @@ public interface IMjReceiver extends IMjConnector { /** Checks to see if {@link #receivePower(long, boolean)} *might* accept any power right now, ignoring the amount of * power contained right now (if any). - * + * * @return True if this {@link IMjReceiver} can receive power right now. */ default boolean canReceive() { return true; diff --git a/api/buildcraft/api/mj/IMjRedstoneReceiver.java b/api/buildcraft/api/mj/IMjRedstoneReceiver.java index 11eb5de..f0e892e 100644 --- a/api/buildcraft/api/mj/IMjRedstoneReceiver.java +++ b/api/buildcraft/api/mj/IMjRedstoneReceiver.java @@ -1,4 +1,5 @@ package buildcraft.api.mj; /** Designates that a receiver can receive redstone power (cheap, free, small amounts) */ -public interface IMjRedstoneReceiver extends IMjReceiver {} +public interface IMjRedstoneReceiver extends IMjReceiver { +} diff --git a/api/buildcraft/api/mj/MjAPI.java b/api/buildcraft/api/mj/MjAPI.java index 5e22e96..9c79550 100644 --- a/api/buildcraft/api/mj/MjAPI.java +++ b/api/buildcraft/api/mj/MjAPI.java @@ -6,7 +6,10 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.common.capabilities.*; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.CapabilityToken; +import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -14,8 +17,7 @@ import java.text.DecimalFormat; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = BCCore.MOD_ID) -public class MjAPI -{ +public class MjAPI { // ################################ // @@ -48,13 +50,11 @@ public class MjAPI /** * Formats a given MJ value to a player-oriented string. Note that this does not append "MJ" to the value. */ - public static String formatMj(long microMj) - { + public static String formatMj(long microMj) { return formatMjInternal(microMj / (double) MJ); } - private static String formatMjInternal(double val) - { + private static String formatMjInternal(double val) { return MJ_DISPLAY_FORMAT.format(val); } @@ -64,23 +64,19 @@ private static String formatMjInternal(double val) // // ######################################## - public enum NullaryEffectManager implements IMjEffectManager - { + public enum NullaryEffectManager implements IMjEffectManager { INSTANCE; @Override - public void createPowerLossEffect(Level world, Vec3 center, long microJoulesLost) - { + public void createPowerLossEffect(Level world, Vec3 center, long microJoulesLost) { } @Override - public void createPowerLossEffect(Level world, Vec3 center, Direction direction, long microJoulesLost) - { + public void createPowerLossEffect(Level world, Vec3 center, Direction direction, long microJoulesLost) { } @Override - public void createPowerLossEffect(Level world, Vec3 center, Vec3 direction, long microJoulesLost) - { + public void createPowerLossEffect(Level world, Vec3 center, Vec3 direction, long microJoulesLost) { } } // @formatter:on @@ -92,35 +88,29 @@ public void createPowerLossEffect(Level world, Vec3 center, Vec3 direction, long // ############### @Nonnull - public static final Capability CAP_CONNECTOR = CapabilityManager.get(new CapabilityToken<>() - { + public static final Capability CAP_CONNECTOR = CapabilityManager.get(new CapabilityToken<>() { }); public static final ResourceLocation CAP_CONNECTOR_ID = new ResourceLocation(BCModules.CORE.getModId(), "mj_connector"); @Nonnull - public static final Capability CAP_RECEIVER = CapabilityManager.get(new CapabilityToken<>() - { + public static final Capability CAP_RECEIVER = CapabilityManager.get(new CapabilityToken<>() { }); public static final ResourceLocation CAP_RECEIVER_ID = new ResourceLocation(BCModules.CORE.getModId(), "mj_receiver"); @Nonnull - public static final Capability CAP_REDSTONE_RECEIVER = CapabilityManager.get(new CapabilityToken<>() - { + public static final Capability CAP_REDSTONE_RECEIVER = CapabilityManager.get(new CapabilityToken<>() { }); @Nonnull - public static final Capability CAP_READABLE = CapabilityManager.get(new CapabilityToken<>() - { + public static final Capability CAP_READABLE = CapabilityManager.get(new CapabilityToken<>() { }); @Nonnull - public static final Capability CAP_PASSIVE_PROVIDER = CapabilityManager.get(new CapabilityToken<>() - { + public static final Capability CAP_PASSIVE_PROVIDER = CapabilityManager.get(new CapabilityToken<>() { }); @SubscribeEvent - public static void registerCapability(RegisterCapabilitiesEvent event) - { + public static void registerCapability(RegisterCapabilitiesEvent event) { event.register(IMjConnector.class); event.register(IMjReceiver.class); event.register(IMjRedstoneReceiver.class); @@ -164,8 +154,7 @@ public static void registerCapability(RegisterCapabilitiesEvent event) // } - private static long getMjValue() - { + private static long getMjValue() { return 1_000_000L; } } diff --git a/api/buildcraft/api/mj/MjBattery.java b/api/buildcraft/api/mj/MjBattery.java index e05247a..e24edc0 100644 --- a/api/buildcraft/api/mj/MjBattery.java +++ b/api/buildcraft/api/mj/MjBattery.java @@ -45,13 +45,14 @@ public long addPower(long microJoulesToAdd, boolean simulate) { } /** Attempts to add power, but only if this is not already full. - * + * * @param microJoulesToAdd The power to add. * @return The excess power. */ public long addPowerChecking(long microJoulesToAdd, boolean simulate) { if (isFull()) { return microJoulesToAdd; - } else { + } + else { return addPower(microJoulesToAdd, simulate); } } @@ -61,7 +62,7 @@ public long extractAll() { } /** Attempts to extract exactly the given amount of power. - * + * * @param power The amount of power to extract. * @return True if the power was removed, false if not. */ public boolean extractPower(long power) { diff --git a/api/buildcraft/api/mj/MjCapabilityHelper.java b/api/buildcraft/api/mj/MjCapabilityHelper.java index 86c5eb1..9b35fa1 100644 --- a/api/buildcraft/api/mj/MjCapabilityHelper.java +++ b/api/buildcraft/api/mj/MjCapabilityHelper.java @@ -11,8 +11,7 @@ /** * Provides a quick way to return all types of a single {@link IMjConnector} for all the different capabilities. */ -public class MjCapabilityHelper implements ICapabilityProvider -{ +public class MjCapabilityHelper implements ICapabilityProvider { @Nonnull private final IMjConnector connector; @@ -29,8 +28,7 @@ public class MjCapabilityHelper implements ICapabilityProvider @Nullable private final IMjPassiveProvider provider; - public MjCapabilityHelper(@Nonnull IMjConnector mj) - { + public MjCapabilityHelper(@Nonnull IMjConnector mj) { this.connector = mj; this.receiver = mj instanceof IMjReceiver ? (IMjReceiver) mj : null; this.rsReceiver = mj instanceof IMjRedstoneReceiver ? (IMjRedstoneReceiver) mj : null; @@ -47,32 +45,26 @@ public MjCapabilityHelper(@Nonnull IMjConnector mj) // } @Override - public LazyOptional getCapability(@Nonnull Capability capability, Direction facing) - { - if (capability == MjAPI.CAP_CONNECTOR) - { + public LazyOptional getCapability(@Nonnull Capability capability, Direction facing) { + if (capability == MjAPI.CAP_CONNECTOR) { // return MjAPI.CAP_CONNECTOR.cast(connector); return connector == null ? LazyOptional.empty() : LazyOptional.of(() -> connector).cast(); } - if (capability == MjAPI.CAP_RECEIVER) - { + if (capability == MjAPI.CAP_RECEIVER) { // return MjAPI.CAP_RECEIVER.cast(receiver); return receiver == null ? LazyOptional.empty() : LazyOptional.of(() -> receiver).cast(); } - if (capability == MjAPI.CAP_REDSTONE_RECEIVER) - { + if (capability == MjAPI.CAP_REDSTONE_RECEIVER) { // return MjAPI.CAP_REDSTONE_RECEIVER.cast(rsReceiver); return rsReceiver == null ? LazyOptional.empty() : LazyOptional.of(() -> rsReceiver).cast(); } - if (capability == MjAPI.CAP_READABLE) - { + if (capability == MjAPI.CAP_READABLE) { // return MjAPI.CAP_READABLE.cast(readable); return readable == null ? LazyOptional.empty() : LazyOptional.of(() -> readable).cast(); } - if (capability == MjAPI.CAP_PASSIVE_PROVIDER) - { + if (capability == MjAPI.CAP_PASSIVE_PROVIDER) { // return MjAPI.CAP_PASSIVE_PROVIDER.cast(provider); - return provider == null ? LazyOptional.empty() :LazyOptional.of(() -> provider).cast(); + return provider == null ? LazyOptional.empty() : LazyOptional.of(() -> provider).cast(); } return LazyOptional.empty(); } diff --git a/api/buildcraft/api/power/IEngine.java b/api/buildcraft/api/power/IEngine.java index ff37f26..bc71333 100644 --- a/api/buildcraft/api/power/IEngine.java +++ b/api/buildcraft/api/power/IEngine.java @@ -10,7 +10,7 @@ * engines without using receivePower() (which has other issues). */ public interface IEngine { /** Returns true if the engine wants to receive power from another engine on this side. - * + * * @param side * @return */ boolean canReceiveFromEngine(Direction side); @@ -20,7 +20,7 @@ public interface IEngine { * @param microJoules The number of micro joules to add. * @param simulate If true then just pretend you received power- don't actually change any of your internal state. * @return True if all the power was accepted, false if not. - * + * * @see buildcraft.api.mj.IMjReceiver#receivePower(long, boolean) */ boolean receivePower(long microJoules, boolean simulate); } diff --git a/api/buildcraft/api/power/IRedstoneEngine.java b/api/buildcraft/api/power/IRedstoneEngine.java index 3fc534d..e942d61 100644 --- a/api/buildcraft/api/power/IRedstoneEngine.java +++ b/api/buildcraft/api/power/IRedstoneEngine.java @@ -4,4 +4,5 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.power; -public interface IRedstoneEngine {} +public interface IRedstoneEngine { +} diff --git a/api/buildcraft/api/properties/BuildCraftProperties.java b/api/buildcraft/api/properties/BuildCraftProperties.java index cc72e06..4b7a7f2 100644 --- a/api/buildcraft/api/properties/BuildCraftProperties.java +++ b/api/buildcraft/api/properties/BuildCraftProperties.java @@ -11,13 +11,12 @@ import java.util.Map; -public final class BuildCraftProperties -{ +public final class BuildCraftProperties { public static final Property BLOCK_FACING = EnumProperty.create("facing", Direction.class, new Direction[]{Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST}); public static final Property BLOCK_FACING_6 = EnumProperty.create("facing", Direction.class); public static final Property BLOCK_COLOR = EnumProperty.create("color", DyeColor.class); -// public static final EnumProperty SPRING_TYPE = EnumProperty.create("type", EnumSpring.class); + // public static final EnumProperty SPRING_TYPE = EnumProperty.create("type", EnumSpring.class); public static final Property ENGINE_TYPE = EnumProperty.create("type", EnumEngineType.class); public static final Property LASER_TABLE_TYPE = EnumProperty.create("type", EnumLaserTableType.class); public static final Property MACHINE_STATE = EnumProperty.create("state", EnumMachineState.class); @@ -74,8 +73,7 @@ public final class BuildCraftProperties */ public static final int UPDATE_ALL = UPDATE_NEIGHBOURS + MARK_BLOCK_FOR_UPDATE + UPDATE_EVEN_CLIENT; - static - { + static { Map> map = Maps.newEnumMap(Direction.class); map.put(Direction.DOWN, CONNECTED_DOWN); map.put(Direction.UP, CONNECTED_UP); @@ -95,7 +93,6 @@ public final class BuildCraftProperties /** * Deactivate constructor */ - private BuildCraftProperties() - { + private BuildCraftProperties() { } } diff --git a/api/buildcraft/api/recipes/AssemblyRecipe.java b/api/buildcraft/api/recipes/AssemblyRecipe.java index fe5094b..2306b13 100644 --- a/api/buildcraft/api/recipes/AssemblyRecipe.java +++ b/api/buildcraft/api/recipes/AssemblyRecipe.java @@ -21,8 +21,7 @@ */ @Deprecated //public abstract class AssemblyRecipe implements Comparable, IForgeRegistryEntry -public abstract class AssemblyRecipe implements Comparable, IForgeRegistryEntry, Recipe -{ +public abstract class AssemblyRecipe implements Comparable, IForgeRegistryEntry, Recipe { public static final ResourceLocation TYPE_ID = new ResourceLocation(BCSilicon.MOD_ID, "assembly"); public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); @@ -57,14 +56,11 @@ public abstract class AssemblyRecipe implements Comparable, IFor public abstract long getRequiredMicroJoulesFor(@Nonnull ItemStack output); @Override - public boolean equals(Object o) - { - if (this == o) - { + public boolean equals(Object o) { + if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) - { + if (o == null || getClass() != o.getClass()) { return false; } @@ -74,76 +70,68 @@ public boolean equals(Object o) } @Override - public int hashCode() - { + public int hashCode() { return name.hashCode(); } @Override - public int compareTo(AssemblyRecipe o) - { + public int compareTo(AssemblyRecipe o) { return name.toString().compareTo(o.name.toString()); } @Override - public AssemblyRecipe setRegistryName(ResourceLocation name) - { + public AssemblyRecipe setRegistryName(ResourceLocation name) { this.name = name; return this; } @Nullable @Override - public ResourceLocation getRegistryName() - { + public ResourceLocation getRegistryName() { return name; } @Override - public Class getRegistryType() - { + public Class getRegistryType() { return AssemblyRecipe.class; } + // Calen: for serialize public abstract long getRequiredMicroJoulesForSerialize(); + public abstract Set getRequiredIngredientStacksForSerialize(); + public abstract Set getOutputForSerialize(); // Calen: forced by Recipe @Override - public ResourceLocation getId() - { + public ResourceLocation getId() { return name; } @Override - public boolean matches(Container inv, Level world) - { + public boolean matches(Container inv, Level world) { return false; } @Override - public boolean canCraftInDimensions(int width, int height) - { + public boolean canCraftInDimensions(int width, int height) { return true; } @Override - public boolean isSpecial() - { + public boolean isSpecial() { return true; } @Override - public RecipeSerializer getSerializer() - { + public RecipeSerializer getSerializer() { return AssemblyRecipeSerializer.INSTANCE; } @Override - public RecipeType getType() - { + public RecipeType getType() { return TYPE; } } diff --git a/api/buildcraft/api/recipes/AssemblyRecipeBasic.java b/api/buildcraft/api/recipes/AssemblyRecipeBasic.java index 61362f4..c35a9c8 100644 --- a/api/buildcraft/api/recipes/AssemblyRecipeBasic.java +++ b/api/buildcraft/api/recipes/AssemblyRecipeBasic.java @@ -21,34 +21,29 @@ * @deprecated TEMPORARY CLASS DO NOT USE! */ @Deprecated -public class AssemblyRecipeBasic extends AssemblyRecipe -{ +public class AssemblyRecipeBasic extends AssemblyRecipe { private final long requiredMicroJoules; private final ImmutableSet requiredStacks; private final ImmutableSet output; - public AssemblyRecipeBasic(ResourceLocation name, long requiredMicroJoules, ImmutableSet requiredStacks, @Nonnull ItemStack output) - { + public AssemblyRecipeBasic(ResourceLocation name, long requiredMicroJoules, ImmutableSet requiredStacks, @Nonnull ItemStack output) { this.requiredMicroJoules = requiredMicroJoules; this.requiredStacks = ImmutableSet.copyOf(requiredStacks); this.output = ImmutableSet.of(output); setRegistryName(name); } - public AssemblyRecipeBasic(String name, long requiredMicroJoules, ImmutableSet requiredStacks, @Nonnull ItemStack output) - { + public AssemblyRecipeBasic(String name, long requiredMicroJoules, ImmutableSet requiredStacks, @Nonnull ItemStack output) { this(BuildCraftAPI.nameToResourceLocation(name), requiredMicroJoules, requiredStacks, output); } - public AssemblyRecipeBasic(String name, long requiredMicroJoules, Set requiredStacks, @Nonnull ItemStack output) - { + public AssemblyRecipeBasic(String name, long requiredMicroJoules, Set requiredStacks, @Nonnull ItemStack output) { this(name, requiredMicroJoules, ImmutableSet.copyOf(requiredStacks), output); } @Override - public Set getOutputs(NonNullList inputs) - { + public Set getOutputs(NonNullList inputs) { if ( requiredStacks.stream().allMatch( (definition) -> @@ -64,52 +59,44 @@ public Set getOutputs(NonNullList inputs) } @Override - public Set getOutputPreviews() - { + public Set getOutputPreviews() { return output; } @Override - public Set getInputsFor(@Nonnull ItemStack output) - { + public Set getInputsFor(@Nonnull ItemStack output) { return requiredStacks; } @Override - public long getRequiredMicroJoulesFor(@Nonnull ItemStack output) - { + public long getRequiredMicroJoulesFor(@Nonnull ItemStack output) { return requiredMicroJoules; } // Calen @Override - public long getRequiredMicroJoulesForSerialize() - { + public long getRequiredMicroJoulesForSerialize() { return requiredMicroJoules; } @Override - public Set getOutputForSerialize() - { + public Set getOutputForSerialize() { return output; } @Override - public Set getRequiredIngredientStacksForSerialize() - { + public Set getRequiredIngredientStacksForSerialize() { return requiredStacks; } @Override - public ItemStack getResultItem() - { + public ItemStack getResultItem() { return output.asList().get(0); } @Override - public ItemStack assemble(Container inv) - { + public ItemStack assemble(Container inv) { return output.asList().get(0); } } diff --git a/api/buildcraft/api/recipes/AssemblyRecipeType.java b/api/buildcraft/api/recipes/AssemblyRecipeType.java index 2cdeaff..8a166cc 100644 --- a/api/buildcraft/api/recipes/AssemblyRecipeType.java +++ b/api/buildcraft/api/recipes/AssemblyRecipeType.java @@ -1,8 +1,7 @@ package buildcraft.api.recipes; // Calen -public enum AssemblyRecipeType -{ +public enum AssemblyRecipeType { BASIC, FACADE, } diff --git a/api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java b/api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java index ea4e570..6174520 100644 --- a/api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java +++ b/api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java @@ -4,11 +4,11 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.recipes; -public final class BuildcraftRecipeRegistry -{ +public final class BuildcraftRecipeRegistry { public static IIntegrationRecipeRegistry integrationRecipes; public static IRefineryRecipeManager refineryRecipes; - private BuildcraftRecipeRegistry() {} + private BuildcraftRecipeRegistry() { + } } diff --git a/api/buildcraft/api/recipes/IIntegrationRecipeProvider.java b/api/buildcraft/api/recipes/IIntegrationRecipeProvider.java index 8518af5..0185609 100644 --- a/api/buildcraft/api/recipes/IIntegrationRecipeProvider.java +++ b/api/buildcraft/api/recipes/IIntegrationRecipeProvider.java @@ -12,7 +12,7 @@ * IIntegrationRecipeViewable. */ public interface IIntegrationRecipeProvider { /** Gets an integration recipe for the given ingredients. - * + * * @param target The center itemstack. * @param toIntegrate A list of stacks to try to integrate to the * @return */ diff --git a/api/buildcraft/api/recipes/IRefineryRecipeManager.java b/api/buildcraft/api/recipes/IRefineryRecipeManager.java index f9065ae..ebe4dc0 100644 --- a/api/buildcraft/api/recipes/IRefineryRecipeManager.java +++ b/api/buildcraft/api/recipes/IRefineryRecipeManager.java @@ -13,14 +13,12 @@ import java.util.function.Predicate; import java.util.stream.Stream; -public interface IRefineryRecipeManager -{ +public interface IRefineryRecipeManager { // IHeatableRecipe createHeatingRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo); IHeatableRecipe createHeatingRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo); // default IHeatableRecipe addHeatableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo) - default IHeatableRecipe addUnregisteredHeatableRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo) - { + default IHeatableRecipe addUnregisteredHeatableRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo) { // return getHeatableRegistry().addRecipe(createHeatingRecipe(in, out, heatFrom, heatTo)); return getHeatableRegistry().addUnregisteredRecipe(createHeatingRecipe(id, in, out, heatFrom, heatTo)); } @@ -29,8 +27,7 @@ default IHeatableRecipe addUnregisteredHeatableRecipe(ResourceLocation id, Fluid ICoolableRecipe createCoolableRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo); // default ICoolableRecipe addCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo) - default ICoolableRecipe addUnregisteredCoolableRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo) - { + default ICoolableRecipe addUnregisteredCoolableRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo) { // return getCoolableRegistry().addRecipe(createCoolableRecipe(in, out, heatFrom, heatTo)); return getCoolableRegistry().addUnregisteredRecipe(createCoolableRecipe(id, in, out, heatFrom, heatTo)); } @@ -39,8 +36,7 @@ default ICoolableRecipe addUnregisteredCoolableRecipe(ResourceLocation id, Fluid IDistillationRecipe createDistillationRecipe(ResourceLocation id, FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired); // default IDistillationRecipe addDistillationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired) - default IDistillationRecipe addUnregisteredDistillationRecipe(ResourceLocation id, FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired) - { + default IDistillationRecipe addUnregisteredDistillationRecipe(ResourceLocation id, FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired) { // return getDistillationRegistry().addRecipe(createDistillationRecipe(in, outGas, outLiquid, powerRequired)); return getDistillationRegistry().addUnregisteredRecipe(createDistillationRecipe(id, in, outGas, outLiquid, powerRequired)); } @@ -51,8 +47,7 @@ default IDistillationRecipe addUnregisteredDistillationRecipe(ResourceLocation i IRefineryRegistry getDistillationRegistry(); - interface IRefineryRegistry - { + interface IRefineryRegistry { /** * @return an unmodifiable collection containing all of the distillation recipes that satisfy the given * predicate. All of the recipe objects are guaranteed to never be null. @@ -88,13 +83,11 @@ interface IRefineryRegistry } // interface IRefineryRecipe - interface IRefineryRecipe extends Recipe - { + interface IRefineryRecipe extends Recipe { FluidStack in(); } - interface IHeatExchangerRecipe extends IRefineryRecipe - { + interface IHeatExchangerRecipe extends IRefineryRecipe { @Nullable FluidStack out(); @@ -103,35 +96,30 @@ interface IHeatExchangerRecipe extends IRefineryRecipe int heatTo(); } - interface IHeatableRecipe extends IHeatExchangerRecipe - { + interface IHeatableRecipe extends IHeatExchangerRecipe { public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.FACTORY.getModId(), "heat_exchange/heatable"); public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); @Override - default RecipeType getType() - { + default RecipeType getType() { return TYPE; } } - interface ICoolableRecipe extends IHeatExchangerRecipe - { + interface ICoolableRecipe extends IHeatExchangerRecipe { public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.FACTORY.getModId(), "heat_exchange/coolable"); public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); @Override - default RecipeType getType() - { + default RecipeType getType() { return TYPE; } } - interface IDistillationRecipe extends IRefineryRecipe - { + interface IDistillationRecipe extends IRefineryRecipe { public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.FACTORY.getModId(), "distillation"); public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); @@ -143,8 +131,7 @@ interface IDistillationRecipe extends IRefineryRecipe FluidStack outLiquid(); @Override - default RecipeType getType() - { + default RecipeType getType() { return TYPE; } } diff --git a/api/buildcraft/api/recipes/IngredientStack.java b/api/buildcraft/api/recipes/IngredientStack.java index 2001cf1..f041ed4 100644 --- a/api/buildcraft/api/recipes/IngredientStack.java +++ b/api/buildcraft/api/recipes/IngredientStack.java @@ -14,52 +14,43 @@ import net.minecraft.world.level.ItemLike; import net.minecraftforge.common.crafting.CraftingHelper; -public final class IngredientStack -{ +public final class IngredientStack { public final Ingredient ingredient; public final int count; - public IngredientStack(Ingredient ingredient, int count) - { + public IngredientStack(Ingredient ingredient, int count) { this.ingredient = ingredient; this.count = count; } - public IngredientStack(Ingredient ingredient) - { + public IngredientStack(Ingredient ingredient) { this(ingredient, 1); } -// public static IngredientStack of(Object o) - public static IngredientStack of(JsonElement o) - { + // public static IngredientStack of(Object o) + public static IngredientStack of(JsonElement o) { return new IngredientStack(CraftingHelper.getIngredient(o)); } - public static IngredientStack of(ItemStack o) - { + public static IngredientStack of(ItemStack o) { return new IngredientStack(Ingredient.of(o)); } - public static IngredientStack of(ItemLike o) - { + public static IngredientStack of(ItemLike o) { return new IngredientStack(Ingredient.of(o)); } - public static IngredientStack of(TagKey tag) - { + public static IngredientStack of(TagKey tag) { return new IngredientStack(Ingredient.of(tag)); } // Calen - public void toNetwork(FriendlyByteBuf buffer) - { + public void toNetwork(FriendlyByteBuf buffer) { buffer.writeInt(this.count); this.ingredient.toNetwork(buffer); } - public static IngredientStack fromNetwork(FriendlyByteBuf buffer) - { + public static IngredientStack fromNetwork(FriendlyByteBuf buffer) { int countIn = buffer.readInt(); Ingredient ingredientIn = Ingredient.fromNetwork(buffer); return new IngredientStack(ingredientIn, countIn); diff --git a/api/buildcraft/api/recipes/StackDefinition.java b/api/buildcraft/api/recipes/StackDefinition.java index e171d58..c364d75 100644 --- a/api/buildcraft/api/recipes/StackDefinition.java +++ b/api/buildcraft/api/recipes/StackDefinition.java @@ -7,8 +7,7 @@ * @deprecated TEMPORARY CLASS DO NOT USE! */ @Deprecated -public final class StackDefinition -{ +public final class StackDefinition { public final IStackFilter filter; public final int count; diff --git a/api/buildcraft/api/registry/BuildCraftRegistryManager.java b/api/buildcraft/api/registry/BuildCraftRegistryManager.java index 31af0df..4dd23f5 100644 --- a/api/buildcraft/api/registry/BuildCraftRegistryManager.java +++ b/api/buildcraft/api/registry/BuildCraftRegistryManager.java @@ -1,7 +1,6 @@ package buildcraft.api.registry; -public class BuildCraftRegistryManager -{ +public class BuildCraftRegistryManager { public static IReloadableRegistryManager managerDataPacks; /** Null on the dedicated server. */ diff --git a/api/buildcraft/api/registry/EventBuildCraftReload.java b/api/buildcraft/api/registry/EventBuildCraftReload.java index e07a039..9cda724 100644 --- a/api/buildcraft/api/registry/EventBuildCraftReload.java +++ b/api/buildcraft/api/registry/EventBuildCraftReload.java @@ -9,8 +9,7 @@ import javax.annotation.Nullable; import java.util.Set; -public abstract class EventBuildCraftReload extends Event -{ +public abstract class EventBuildCraftReload extends Event { /** The manager that is being reloaded. */ public final IReloadableRegistryManager manager; @@ -27,7 +26,7 @@ public EventBuildCraftReload(IReloadableRegistryManager manager, Set> reloadingRegistries) { + @Nullable Set> reloadingRegistries) { super(manager, reloadingRegistries); } } @@ -48,7 +47,7 @@ public static class PopulateGson extends EventBuildCraftReload { public final GsonBuilder gsonBuilder; public PopulateGson(IReloadableRegistryManager manager, - @Nullable Set> reloadingRegistries, GsonBuilder gsonBuilder) { + @Nullable Set> reloadingRegistries, GsonBuilder gsonBuilder) { super(manager, reloadingRegistries); this.gsonBuilder = gsonBuilder; } @@ -66,7 +65,7 @@ public PostLoad(IReloadableRegistryManager manager, @Nullable Set> reloadingRegistries) { + @Nullable Set> reloadingRegistries) { super(manager, reloadingRegistries); } } diff --git a/api/buildcraft/api/registry/IReloadableRegistryManager.java b/api/buildcraft/api/registry/IReloadableRegistryManager.java index d62ac5e..f1a88bb 100644 --- a/api/buildcraft/api/registry/IReloadableRegistryManager.java +++ b/api/buildcraft/api/registry/IReloadableRegistryManager.java @@ -5,8 +5,7 @@ import java.util.Map; import java.util.Set; -public interface IReloadableRegistryManager -{ +public interface IReloadableRegistryManager { PackType getType(); @@ -34,7 +33,7 @@ public interface IReloadableRegistryManager Map> getAllRegistries(); /** Creates and registers a basic {@link IReloadableRegistry}. - * + * * @param name The name for the given registry. This should be unique, and the best way of doing that is to prefix * it with the modid, followed by a slash, and then the mod-unique name. * @throws IllegalArgumentException if name contains a colon. */ @@ -42,7 +41,7 @@ public interface IReloadableRegistryManager /** Scripts will be loaded from "[pack_type.prefix]/[pack_name]/compat/[entry_path]/". The entryPath parameter * should start with the modid. - * + * * @param entryPath */ IScriptableRegistry createScriptableRegistry(String entryPath); diff --git a/api/buildcraft/api/registry/IScriptableRegistry.java b/api/buildcraft/api/registry/IScriptableRegistry.java index 734251b..e72726a 100644 --- a/api/buildcraft/api/registry/IScriptableRegistry.java +++ b/api/buildcraft/api/registry/IScriptableRegistry.java @@ -54,7 +54,7 @@ public interface IEntryDeserializer { * @throws JsonSyntaxException if the input {@link JsonObject} was either missing required fields or had the * wrong type or data for those fields. */ OptionallyDisabled deserialize(ResourceLocation name, JsonObject obj, JsonDeserializationContext ctx) - throws JsonSyntaxException; + throws JsonSyntaxException; } /** Similar to {@link IEntryDeserializer} except that this guarantees that @@ -69,7 +69,7 @@ public interface ISimpleEntryDeserializer extends IEntryDeserializer { * {@link #deserializeConst(ResourceLocation, JsonObject, JsonDeserializationContext)} directly. */ @Override default OptionallyDisabled deserialize(ResourceLocation name, JsonObject obj, JsonDeserializationContext ctx) - throws JsonSyntaxException { + throws JsonSyntaxException { return new OptionallyDisabled<>(deserializeConst(name, obj, ctx)); } @@ -80,7 +80,7 @@ default OptionallyDisabled deserialize(ResourceLocation name, JsonObject obj, * @throws JsonSyntaxException if the input {@link JsonObject} was either missing required fields or had the * wrong type or data for those fields. */ E deserializeConst(ResourceLocation name, JsonObject obj, JsonDeserializationContext ctx) - throws JsonSyntaxException; + throws JsonSyntaxException; } /** A simple wrapper which either contains the object, or a string with a reason why it is allowed to be null. */ @@ -111,7 +111,8 @@ public E get() { final E o = object; if (o != null) { return o; - } else { + } + else { throw new IllegalStateException("This object has been disabled! You must call isPresent() first!"); } } @@ -121,7 +122,8 @@ public String getDisabledReason() { final String r = reason; if (r != null) { return r; - } else { + } + else { throw new IllegalStateException("This object has not been disabled! You must call isPresent() first!"); } } diff --git a/api/buildcraft/api/robots/AIRobot.java b/api/buildcraft/api/robots/AIRobot.java index 5acf192..5e27450 100755 --- a/api/buildcraft/api/robots/AIRobot.java +++ b/api/buildcraft/api/robots/AIRobot.java @@ -41,14 +41,14 @@ public void end() { } /** This gets called when a delegate AI ends work naturally. - * + * * @param ai The delegate AI which ended work. */ public void delegateAIEnded(AIRobot ai) { } /** This gets called when a delegate AI is forcibly aborted. - * + * * @param ai The delegate AI which was aborted. */ public void delegateAIAborted(AIRobot ai) { @@ -103,7 +103,8 @@ public final void abort() { parentAI.delegateAI = null; parentAI.delegateAIAborted(this); } - } catch (Throwable e) { + } + catch (Throwable e) { e.printStackTrace(); delegateAI = null; @@ -119,11 +120,13 @@ public final void cycle() { if (delegateAI != null) { delegateAI.cycle(); - } else { + } + else { robot.getBattery().extractPower(1, getPowerCost()); update(); } - } catch (Throwable e) { + } + catch (Throwable e) { e.printStackTrace(); abort(); } @@ -145,7 +148,8 @@ public final void abortDelegateAI() { public final AIRobot getActiveAI() { if (delegateAI != null) { return delegateAI.getActiveAI(); - } else { + } + else { return this; } } @@ -180,7 +184,8 @@ public final void loadFromNBT(CompoundTag nbt) { if (sub.contains("class")) { // Migration support for 6.4.x aiRobotClass = RobotManager.getAIRobotByLegacyClassName(sub.getString("class")); - } else { + } + else { aiRobotClass = RobotManager.getAIRobotByName(sub.getString("aiName")); } if (aiRobotClass != null) { @@ -191,7 +196,8 @@ public final void loadFromNBT(CompoundTag nbt) { delegateAI.loadFromNBT(sub); } } - } catch (Throwable e) { + } + catch (Throwable e) { e.printStackTrace(); } } @@ -205,14 +211,16 @@ public static AIRobot loadAI(CompoundTag nbt, EntityRobotBase robot) { if (nbt.contains("class")) { // Migration support for 6.4.x aiRobotClass = RobotManager.getAIRobotByLegacyClassName(nbt.getString("class")); - } else { + } + else { aiRobotClass = RobotManager.getAIRobotByName(nbt.getString("aiName")); } if (aiRobotClass != null) { ai = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class).newInstance(robot); ai.loadFromNBT(nbt); } - } catch (Throwable e) { + } + catch (Throwable e) { e.printStackTrace(); } diff --git a/api/buildcraft/api/robots/DockingStation.java b/api/buildcraft/api/robots/DockingStation.java index 2a315a8..58242ff 100755 --- a/api/buildcraft/api/robots/DockingStation.java +++ b/api/buildcraft/api/robots/DockingStation.java @@ -33,7 +33,8 @@ public DockingStation(BlockPos iIndex, Direction iSide) { side = iSide; } - public DockingStation() {} + public DockingStation() { + } public boolean isMainStation() { return linkIsMain; @@ -50,7 +51,8 @@ public Direction side() { public EntityRobotBase robotTaking() { if (robotTakingId == EntityRobotBase.NULL_ROBOT_ID) { return null; - } else if (robotTaking == null) { + } + else if (robotTaking == null) { robotTaking = RobotManager.registryProvider.getRegistry(world).getLoadedRobot(robotTakingId); } @@ -76,7 +78,8 @@ public boolean takeAsMain(EntityRobotBase robot) { registry.take(this, robot.getRobotId()); return true; - } else { + } + else { return robotTakingId == robot.getRobotId(); } } @@ -91,7 +94,8 @@ public boolean take(EntityRobotBase robot) { registry.take(this, robot.getRobotId()); return true; - } else { + } + else { return robot.getRobotId() == robotTakingId; } } @@ -115,7 +119,7 @@ public void unsafeRelease(EntityRobotBase robot) { } public void writeToNBT(CompoundTag nbt) { - nbt.putIntArray("pos", new int[] { getPos().getX(), getPos().getY(), getPos().getZ() }); + nbt.putIntArray("pos", new int[]{getPos().getX(), getPos().getY(), getPos().getZ()}); nbt.putByte("side", (byte) side.ordinal()); nbt.putBoolean("isMain", linkIsMain); nbt.putLong("robotId", robotTakingId); @@ -129,13 +133,16 @@ public void readFromNBT(CompoundTag nbt) { int y = indexNBT.getInt("j"); int z = indexNBT.getInt("k"); pos = new BlockPos(x, y, z); - } else { + } + else { int[] array = nbt.getIntArray("pos"); if (array.length == 3) { pos = new BlockPos(array[0], array[1], array[2]); - } else if (array.length != 0) { + } + else if (array.length != 0) { BCLog.logger.warn("Found an integer array that was not the right length! (" + Arrays.toString(array) + ")"); - } else { + } + else { BCLog.logger.warn("Did not find any integer positions! This is a bug!"); } } @@ -164,7 +171,8 @@ public String toString() { public boolean linkIsDocked() { if (robotTaking() != null) { return robotTaking().getDockingStation() == this; - } else { + } + else { return false; } } diff --git a/api/buildcraft/api/robots/EntityRobotBase.java b/api/buildcraft/api/robots/EntityRobotBase.java index 599369b..f389e2e 100755 --- a/api/buildcraft/api/robots/EntityRobotBase.java +++ b/api/buildcraft/api/robots/EntityRobotBase.java @@ -19,7 +19,7 @@ public abstract class EntityRobotBase extends LivingEntity implements IItemHandler, IFluidHandlerAdv { - public static final long MAX_POWER = 5000 * MjAPI.MJ; + public static final long MAX_POWER = 5000 * MjAPI.MJ; public static final long SAFETY_POWER = MAX_POWER / 5; public static final long SHUTDOWN_POWER = 0; public static final long NULL_ROBOT_ID = Long.MAX_VALUE; @@ -27,7 +27,7 @@ public abstract class EntityRobotBase extends LivingEntity implements IItemHandl public EntityRobotBase(Level par1World) { // TODO Calen robot entity type? // super(par1World); - super(null,par1World); + super(null, par1World); } public abstract void setItemInUse(ItemStack stack); diff --git a/api/buildcraft/api/robots/ResourceId.java b/api/buildcraft/api/robots/ResourceId.java index 8660725..9151afe 100755 --- a/api/buildcraft/api/robots/ResourceId.java +++ b/api/buildcraft/api/robots/ResourceId.java @@ -8,13 +8,15 @@ public abstract class ResourceId { - protected ResourceId() {} + protected ResourceId() { + } public void writeToNBT(CompoundTag nbt) { nbt.putString("resourceName", RobotManager.getResourceIdName(getClass())); } - protected void readFromNBT(CompoundTag nbt) {} + protected void readFromNBT(CompoundTag nbt) { + } public static ResourceId load(CompoundTag nbt) { try { @@ -22,7 +24,8 @@ public static ResourceId load(CompoundTag nbt) { if (nbt.contains("class")) { // Migration support for 6.4.x cls = RobotManager.getResourceIdByLegacyClassName(nbt.getString("class")); - } else { + } + else { cls = RobotManager.getResourceIdByName(nbt.getString("resourceName")); } @@ -30,7 +33,8 @@ public static ResourceId load(CompoundTag nbt) { id.readFromNBT(nbt); return id; - } catch (Throwable e) { + } + catch (Throwable e) { e.printStackTrace(); } diff --git a/api/buildcraft/api/robots/ResourceIdBlock.java b/api/buildcraft/api/robots/ResourceIdBlock.java index ad235db..7a8b9a9 100755 --- a/api/buildcraft/api/robots/ResourceIdBlock.java +++ b/api/buildcraft/api/robots/ResourceIdBlock.java @@ -52,7 +52,7 @@ public int hashCode() { public void writeToNBT(CompoundTag nbt) { super.writeToNBT(nbt); - int[] arr = new int[] { pos.getX(), pos.getY(), pos.getZ() }; + int[] arr = new int[]{pos.getX(), pos.getY(), pos.getZ()}; nbt.putIntArray("pos", arr); nbt.put("side", side.writeToNBT()); diff --git a/api/buildcraft/api/robots/RobotManager.java b/api/buildcraft/api/robots/RobotManager.java index 98dd22b..831ea74 100644 --- a/api/buildcraft/api/robots/RobotManager.java +++ b/api/buildcraft/api/robots/RobotManager.java @@ -51,7 +51,8 @@ public static void registerAIRobot(Class aiRobot, String name // Check if NBT-load constructor is present try { aiRobot.getConstructor(EntityRobotBase.class); - } catch (NoSuchMethodException e) { + } + catch (NoSuchMethodException e) { throw new RuntimeException("AI class " + aiRobot.getName() + " lacks NBT load constructor! This is a bug!"); } diff --git a/api/buildcraft/api/schematics/ISchematicBlock.java b/api/buildcraft/api/schematics/ISchematicBlock.java index d3adcea..bdb4a9b 100644 --- a/api/buildcraft/api/schematics/ISchematicBlock.java +++ b/api/buildcraft/api/schematics/ISchematicBlock.java @@ -14,8 +14,7 @@ import java.util.List; import java.util.Set; -public interface ISchematicBlock -{ +public interface ISchematicBlock { void init(SchematicBlockContext context); default boolean isAir() { @@ -47,7 +46,7 @@ default boolean isReadyToBuild(Level world, BlockPos blockPos) { boolean build(Level world, BlockPos blockPos); -// boolean buildWithoutChecks(Level world, BlockPos blockPos); + // boolean buildWithoutChecks(Level world, BlockPos blockPos); boolean buildWithoutChecks(FakeWorld world, BlockPos blockPos); boolean isBuilt(Level world, BlockPos blockPos); diff --git a/api/buildcraft/api/schematics/ISchematicEntity.java b/api/buildcraft/api/schematics/ISchematicEntity.java index 39db485..4b9805e 100644 --- a/api/buildcraft/api/schematics/ISchematicEntity.java +++ b/api/buildcraft/api/schematics/ISchematicEntity.java @@ -14,8 +14,7 @@ import java.util.Collections; import java.util.List; -public interface ISchematicEntity -{ +public interface ISchematicEntity { void init(SchematicEntityContext context); Vec3 getPos(); diff --git a/api/buildcraft/api/schematics/SchematicBlockContext.java b/api/buildcraft/api/schematics/SchematicBlockContext.java index b50dffe..09126c0 100644 --- a/api/buildcraft/api/schematics/SchematicBlockContext.java +++ b/api/buildcraft/api/schematics/SchematicBlockContext.java @@ -7,8 +7,7 @@ import javax.annotation.Nonnull; -public class SchematicBlockContext -{ +public class SchematicBlockContext { @Nonnull public final Level world; @Nonnull diff --git a/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java b/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java index 9ad5f85..9b3c90b 100644 --- a/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java +++ b/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java @@ -14,12 +14,11 @@ import java.util.function.Supplier; public class SchematicBlockFactoryRegistry { -// private static final Set> FACTORIES = new TreeSet<>(); + // private static final Set> FACTORIES = new TreeSet<>(); private static final Set> FACTORIES = new ConcurrentSkipListSet<>(); // Calen thread safety: sometimes "air" not registered just after BCBuildersSchematics#preInit:registerSchematicFactory("air", 0, SchematicBlockAir::predicate, SchematicBlockAir::new) - public synchronized static Set> getFactoriesSynchronized() - { + public synchronized static Set> getFactoriesSynchronized() { return FACTORIES; } @@ -29,10 +28,10 @@ public static void registerFactory(String name, Supplier supplier) { // FACTORIES.add(new SchematicBlockFactory<>( getFactoriesSynchronized().add(new SchematicBlockFactory<>( - BuildCraftAPI.nameToResourceLocation(name), - priority, - predicate, - supplier + BuildCraftAPI.nameToResourceLocation(name), + priority, + predicate, + supplier )); } @@ -41,10 +40,10 @@ public static void registerFactory(String name, List blocks, Supplier supplier) { registerFactory( - name, - priority, - context -> blocks.contains(context.block), - supplier + name, + priority, + context -> blocks.contains(context.block), + supplier ); } @@ -58,17 +57,17 @@ public static SchematicBlockFactory getFactoryByI // noinspection unchecked // return (SchematicBlockFactory) FACTORIES.stream() return (SchematicBlockFactory) getFactoriesSynchronized().stream() - .filter(schematicBlockFactory -> schematicBlockFactory.clazz == instance.getClass()) - .findFirst() - .orElseThrow(() -> new IllegalStateException("Didn't find a factory for " + instance.getClass())); + .filter(schematicBlockFactory -> schematicBlockFactory.clazz == instance.getClass()) + .findFirst() + .orElseThrow(() -> new IllegalStateException("Didn't find a factory for " + instance.getClass())); } @Nullable public static SchematicBlockFactory getFactoryByName(ResourceLocation name) { // return FACTORIES.stream() return getFactoriesSynchronized().stream() - .filter(schematicBlockFactory -> schematicBlockFactory.name.equals(name)) - .findFirst() - .orElse(null); + .filter(schematicBlockFactory -> schematicBlockFactory.name.equals(name)) + .findFirst() + .orElse(null); } } diff --git a/api/buildcraft/api/schematics/SchematicEntityContext.java b/api/buildcraft/api/schematics/SchematicEntityContext.java index fa61899..11c63ac 100644 --- a/api/buildcraft/api/schematics/SchematicEntityContext.java +++ b/api/buildcraft/api/schematics/SchematicEntityContext.java @@ -6,8 +6,7 @@ import javax.annotation.Nonnull; -public class SchematicEntityContext -{ +public class SchematicEntityContext { @Nonnull public final Level world; @Nonnull diff --git a/api/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java b/api/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java index 986a617..d64ff82 100644 --- a/api/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java +++ b/api/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java @@ -12,8 +12,7 @@ import java.util.function.Predicate; import java.util.function.Supplier; -public class SchematicEntityFactoryRegistry -{ +public class SchematicEntityFactoryRegistry { private static final Set> FACTORIES = new TreeSet<>(); public static void registerFactory(String name, @@ -21,10 +20,10 @@ public static void registerFactory(String name, Predicate predicate, Supplier supplier) { FACTORIES.add(new SchematicEntityFactory<>( - BuildCraftAPI.nameToResourceLocation(name), - priority, - predicate, - supplier + BuildCraftAPI.nameToResourceLocation(name), + priority, + predicate, + supplier )); } @@ -50,16 +49,16 @@ public static List> getFactories() { public static SchematicEntityFactory getFactoryByInstance(S instance) { // noinspection unchecked return (SchematicEntityFactory) FACTORIES.stream() - .filter(schematicEntityFactory -> schematicEntityFactory.clazz == instance.getClass()) - .findFirst() - .orElseThrow(() -> new IllegalStateException("Didn't find a factory for " + instance.getClass())); + .filter(schematicEntityFactory -> schematicEntityFactory.clazz == instance.getClass()) + .findFirst() + .orElseThrow(() -> new IllegalStateException("Didn't find a factory for " + instance.getClass())); } @Nullable public static SchematicEntityFactory getFactoryByName(ResourceLocation name) { return FACTORIES.stream() - .filter(schematicEntityFactory -> schematicEntityFactory.name.equals(name)) - .findFirst() - .orElse(null); + .filter(schematicEntityFactory -> schematicEntityFactory.name.equals(name)) + .findFirst() + .orElse(null); } } diff --git a/api/buildcraft/api/statements/IAction.java b/api/buildcraft/api/statements/IAction.java index 2cd0c35..1af6d00 100644 --- a/api/buildcraft/api/statements/IAction.java +++ b/api/buildcraft/api/statements/IAction.java @@ -3,4 +3,5 @@ /** Marker interface that designates a class as being an action. Note that you *must* implement ONE of the following * interfaces to be recognised as an action: {@link IActionInternal}, {@link IActionInternalSided}, or * {@link IActionExternal} */ -public interface IAction extends IStatement {} +public interface IAction extends IStatement { +} diff --git a/api/buildcraft/api/statements/IActionProvider.java b/api/buildcraft/api/statements/IActionProvider.java index cccf53f..80c4141 100644 --- a/api/buildcraft/api/statements/IActionProvider.java +++ b/api/buildcraft/api/statements/IActionProvider.java @@ -10,8 +10,7 @@ import javax.annotation.Nonnull; import java.util.Collection; -public interface IActionProvider -{ +public interface IActionProvider { void addInternalActions(Collection actions, IStatementContainer container); void addInternalSidedActions(Collection actions, IStatementContainer container, @Nonnull Direction side); diff --git a/api/buildcraft/api/statements/IActionReceptor.java b/api/buildcraft/api/statements/IActionReceptor.java index 9a53b4d..34155b8 100644 --- a/api/buildcraft/api/statements/IActionReceptor.java +++ b/api/buildcraft/api/statements/IActionReceptor.java @@ -4,7 +4,6 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.statements; -public interface IActionReceptor -{ +public interface IActionReceptor { void actionActivated(IStatement statement, IStatementParameter[] parameters); } diff --git a/api/buildcraft/api/statements/IGuiSlot.java b/api/buildcraft/api/statements/IGuiSlot.java index ca996f8..7df96b3 100644 --- a/api/buildcraft/api/statements/IGuiSlot.java +++ b/api/buildcraft/api/statements/IGuiSlot.java @@ -10,8 +10,7 @@ import javax.annotation.Nullable; import java.util.List; -public interface IGuiSlot extends IConvertable -{ +public interface IGuiSlot extends IConvertable { /** * Every statement needs a unique tag, it should be in the format of "<modid>:<name>". * @@ -35,12 +34,10 @@ public interface IGuiSlot extends IConvertable * @return The full tooltip for the UI. */ @OnlyIn(Dist.CLIENT) - default List getTooltip() - { + default List getTooltip() { // String desc = getDescription(); Component desc = getDescription(); - if (desc == null) - { + if (desc == null) { return ImmutableList.of(); } // return ImmutableList.of(new TextComponent(desc)); @@ -49,11 +46,9 @@ default List getTooltip() // Calen @OnlyIn(Dist.CLIENT) - default List getTooltipKey() - { + default List getTooltipKey() { String desc = getDescriptionKey(); - if (desc == null) - { + if (desc == null) { return ImmutableList.of(); } // return ImmutableList.of(new TextComponent(desc)); diff --git a/api/buildcraft/api/statements/IOverrideDefaultStatements.java b/api/buildcraft/api/statements/IOverrideDefaultStatements.java index 0d40d7d..cb2dc78 100644 --- a/api/buildcraft/api/statements/IOverrideDefaultStatements.java +++ b/api/buildcraft/api/statements/IOverrideDefaultStatements.java @@ -6,8 +6,7 @@ import java.util.List; -public interface IOverrideDefaultStatements -{ +public interface IOverrideDefaultStatements { List overrideTriggers(); List overrideActions(); diff --git a/api/buildcraft/api/statements/IStatement.java b/api/buildcraft/api/statements/IStatement.java index b8d61a9..7f769cf 100644 --- a/api/buildcraft/api/statements/IStatement.java +++ b/api/buildcraft/api/statements/IStatement.java @@ -21,7 +21,7 @@ public interface IStatement extends IGuiSlot { * this checks the classes of the old and new parameters, however it is sensible to override this check in case the * parameters given no longer match. For example if you return {@link StatementParameterItemStack} from * {@link #createParameter(int)} and require the stack to match a filter, but the incoming stack might not. - * + * * @param old * @param index * @return */ @@ -29,7 +29,8 @@ default IStatementParameter createParameter(IStatementParameter old, int index) IStatementParameter _new = createParameter(index); if (old == null || _new == null) { return _new; - } else if (old.getClass() == _new.getClass()) { + } + else if (old.getClass() == _new.getClass()) { return old; } return _new; diff --git a/api/buildcraft/api/statements/IStatementContainer.java b/api/buildcraft/api/statements/IStatementContainer.java index 378f72f..0ce1941 100644 --- a/api/buildcraft/api/statements/IStatementContainer.java +++ b/api/buildcraft/api/statements/IStatementContainer.java @@ -10,8 +10,7 @@ import javax.annotation.Nullable; /** This is implemented by objects containing Statements, such as Gates and TileEntities. */ -public interface IStatementContainer -{ +public interface IStatementContainer { BlockEntity getTile(); @Nullable diff --git a/api/buildcraft/api/statements/IStatementParameter.java b/api/buildcraft/api/statements/IStatementParameter.java index ef7ae9a..e03889e 100755 --- a/api/buildcraft/api/statements/IStatementParameter.java +++ b/api/buildcraft/api/statements/IStatementParameter.java @@ -25,10 +25,10 @@ default DrawType getDrawType() { /** Return a non-null value to be set as the statement parameter if you handled the mouse click and do not want all * possible values to be shown, or null if you did nothing and wish to show all possible values. - * + * * @see #getPossible(IStatementContainer) */ IStatementParameter onClick(IStatementContainer source, IStatement stmt, ItemStack stack, - StatementMouseClick mouse); + StatementMouseClick mouse); void writeToNbt(CompoundTag nbt); diff --git a/api/buildcraft/api/statements/ITrigger.java b/api/buildcraft/api/statements/ITrigger.java index cdb65c9..46e31e7 100644 --- a/api/buildcraft/api/statements/ITrigger.java +++ b/api/buildcraft/api/statements/ITrigger.java @@ -3,4 +3,5 @@ /** Marker interface that designates a class as being a trigger. Note that you *must* implement ONE of the following * interfaces to be recognised as a trigger: {@link ITriggerInternal}, {@link ITriggerInternalSided}, or * {@link ITriggerExternal} */ -public interface ITrigger extends IStatement {} +public interface ITrigger extends IStatement { +} diff --git a/api/buildcraft/api/statements/ITriggerExternalOverride.java b/api/buildcraft/api/statements/ITriggerExternalOverride.java index ed38f56..5e7db16 100644 --- a/api/buildcraft/api/statements/ITriggerExternalOverride.java +++ b/api/buildcraft/api/statements/ITriggerExternalOverride.java @@ -5,8 +5,7 @@ /** This interface can be used by tiles to override external trigger behaviour. * * Please use wisely. */ -public interface ITriggerExternalOverride -{ +public interface ITriggerExternalOverride { enum Result { TRUE, FALSE, diff --git a/api/buildcraft/api/statements/ITriggerProvider.java b/api/buildcraft/api/statements/ITriggerProvider.java index d2c1bfc..2f88590 100644 --- a/api/buildcraft/api/statements/ITriggerProvider.java +++ b/api/buildcraft/api/statements/ITriggerProvider.java @@ -10,8 +10,7 @@ import javax.annotation.Nonnull; import java.util.Collection; -public interface ITriggerProvider -{ +public interface ITriggerProvider { void addInternalTriggers(Collection triggers, IStatementContainer container); void addInternalSidedTriggers(Collection triggers, IStatementContainer container, @Nonnull Direction side); diff --git a/api/buildcraft/api/statements/StatementManager.java b/api/buildcraft/api/statements/StatementManager.java index 8ee8591..89086af 100644 --- a/api/buildcraft/api/statements/StatementManager.java +++ b/api/buildcraft/api/statements/StatementManager.java @@ -7,21 +7,19 @@ import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.chat.Component; import net.minecraft.world.level.block.entity.BlockEntity; import java.io.IOException; import java.util.*; -public final class StatementManager -{ +public final class StatementManager { // Calen: Thread Safety -> InvalidInputDataException: Unknown paramater type buildcraft:fillerParameterYDir public static Map statements = new HashMap<>(); -// public static Map statements = new ConcurrentHashMap<>(); + // public static Map statements = new ConcurrentHashMap<>(); public static Map parameters = new HashMap<>(); -// public static Map parameters = new ConcurrentHashMap<>(); + // public static Map parameters = new ConcurrentHashMap<>(); public static Map paramsBuf = new HashMap<>(); -// public static Map paramsBuf = new ConcurrentHashMap<>(); + // public static Map paramsBuf = new ConcurrentHashMap<>(); private static List triggerProviders = new LinkedList<>(); private static List actionProviders = new LinkedList<>(); @@ -40,7 +38,8 @@ public interface IParamReaderBuf { } /** Deactivate constructor */ - private StatementManager() {} + private StatementManager() { + } public static void registerTriggerProvider(ITriggerProvider provider) { if (provider != null && !triggerProviders.contains(provider)) { diff --git a/api/buildcraft/api/statements/StatementMouseClick.java b/api/buildcraft/api/statements/StatementMouseClick.java index 3ecc746..c39ed33 100644 --- a/api/buildcraft/api/statements/StatementMouseClick.java +++ b/api/buildcraft/api/statements/StatementMouseClick.java @@ -4,8 +4,7 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.statements; -public final class StatementMouseClick -{ +public final class StatementMouseClick { private int button; private boolean shift; diff --git a/api/buildcraft/api/statements/StatementParameterItemStack.java b/api/buildcraft/api/statements/StatementParameterItemStack.java index af69789..d7b60a4 100755 --- a/api/buildcraft/api/statements/StatementParameterItemStack.java +++ b/api/buildcraft/api/statements/StatementParameterItemStack.java @@ -22,8 +22,7 @@ import java.util.List; import java.util.Objects; -public class StatementParameterItemStack implements IStatementParameter -{ +public class StatementParameterItemStack implements IStatementParameter { // needed because ItemStack.EMPTY doesn't have @Nonnull applied to it :/ @Nonnull private static final ItemStack EMPTY_STACK; @@ -33,8 +32,7 @@ public class StatementParameterItemStack implements IStatementParameter */ public static final StatementParameterItemStack EMPTY; - static - { + static { ItemStack stack = ItemStack.EMPTY; if (stack == null) throw new Error("Somehow ItemStack.EMPTY was null!"); EMPTY_STACK = stack; @@ -44,34 +42,27 @@ public class StatementParameterItemStack implements IStatementParameter @Nonnull protected final ItemStack stack; - public StatementParameterItemStack() - { + public StatementParameterItemStack() { stack = EMPTY_STACK; } - public StatementParameterItemStack(@Nonnull ItemStack stack) - { + public StatementParameterItemStack(@Nonnull ItemStack stack) { this.stack = stack; } - public StatementParameterItemStack(CompoundTag nbt) - { + public StatementParameterItemStack(CompoundTag nbt) { ItemStack read = ItemStack.of(nbt.getCompound("stack")); - if (read.isEmpty()) - { + if (read.isEmpty()) { stack = EMPTY_STACK; } - else - { + else { stack = read; } } @Override - public void writeToNbt(CompoundTag compound) - { - if (!stack.isEmpty()) - { + public void writeToNbt(CompoundTag compound) { + if (!stack.isEmpty()) { CompoundTag tagCompound = new CompoundTag(); stack.save(tagCompound); compound.put("stack", tagCompound); @@ -79,29 +70,24 @@ public void writeToNbt(CompoundTag compound) } @Override - public ISprite getSprite() - { + public ISprite getSprite() { return null; } @Override @Nonnull - public ItemStack getItemStack() - { + public ItemStack getItemStack() { return stack; } @Override public StatementParameterItemStack onClick( IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse - ) - { - if (stack.isEmpty()) - { + ) { + if (stack.isEmpty()) { return EMPTY; } - else - { + else { ItemStack newStack = stack.copy(); newStack.setCount(1); return new StatementParameterItemStack(newStack); @@ -109,73 +95,61 @@ public StatementParameterItemStack onClick( } @Override - public boolean equals(Object object) - { - if (object instanceof StatementParameterItemStack) - { + public boolean equals(Object object) { + if (object instanceof StatementParameterItemStack) { StatementParameterItemStack param = (StatementParameterItemStack) object; return ItemStack.isSameItemSameTags(stack, param.stack); } - else - { + else { return false; } } @Override - public int hashCode() - { + public int hashCode() { return Objects.hashCode(stack); } @Override @OnlyIn(Dist.CLIENT) - public Component getDescription() - { + public Component getDescription() { throw new UnsupportedOperationException("Don't call getDescription directly!"); } + @Override @OnlyIn(Dist.CLIENT) - public String getDescriptionKey() - { + public String getDescriptionKey() { throw new UnsupportedOperationException("Don't call getDescription directly!"); } @Override @OnlyIn(Dist.CLIENT) - public List getTooltip() - { - if (stack.isEmpty()) - { + public List getTooltip() { + if (stack.isEmpty()) { return ImmutableList.of(); } List tooltip = stack.getTooltipLines(null, TooltipFlag.Default.NORMAL); - if (!tooltip.isEmpty()) - { + if (!tooltip.isEmpty()) { tooltip.set(0, new TextComponent(stack.getRarity().color.toString()).append(tooltip.get(0))); - for (int i = 1; i < tooltip.size(); i++) - { + for (int i = 1; i < tooltip.size(); i++) { tooltip.set(i, new TextComponent(ChatFormatting.GRAY.toString()).append(tooltip.get(i))); } } return tooltip; } + @Override @OnlyIn(Dist.CLIENT) - public List getTooltipKey() - { - if (stack.isEmpty()) - { + public List getTooltipKey() { + if (stack.isEmpty()) { return ImmutableList.of(); } List tooltip = stack.getTooltipLines(null, TooltipFlag.Default.NORMAL); List toolTipRet = new ArrayList<>(tooltip.size()); - if (!tooltip.isEmpty()) - { + if (!tooltip.isEmpty()) { toolTipRet.set(0, new TextComponent(stack.getRarity().color.toString()).append(tooltip.get(0)).getString()); - for (int i = 1; i < tooltip.size(); i++) - { + for (int i = 1; i < tooltip.size(); i++) { toolTipRet.set(i, new TextComponent(ChatFormatting.GRAY.toString()).append(tooltip.get(i)).getString()); } } @@ -183,20 +157,17 @@ public List getTooltipKey() } @Override - public String getUniqueTag() - { + public String getUniqueTag() { return "buildcraft:stack"; } @Override - public IStatementParameter rotateLeft() - { + public IStatementParameter rotateLeft() { return this; } @Override - public IStatementParameter[] getPossible(IStatementContainer source) - { + public IStatementParameter[] getPossible(IStatementContainer source) { return null; } } diff --git a/api/buildcraft/api/statements/StatementSlot.java b/api/buildcraft/api/statements/StatementSlot.java index da0bcb7..23e1cff 100755 --- a/api/buildcraft/api/statements/StatementSlot.java +++ b/api/buildcraft/api/statements/StatementSlot.java @@ -10,8 +10,7 @@ import java.util.Arrays; import java.util.Objects; -public class StatementSlot -{ +public class StatementSlot { public IStatement statement; public IStatementParameter[] parameters; public EnumPipePart part = EnumPipePart.CENTER; diff --git a/api/buildcraft/api/statements/containers/IRedstoneStatementContainer.java b/api/buildcraft/api/statements/containers/IRedstoneStatementContainer.java index cfd57f1..bab96bb 100644 --- a/api/buildcraft/api/statements/containers/IRedstoneStatementContainer.java +++ b/api/buildcraft/api/statements/containers/IRedstoneStatementContainer.java @@ -2,16 +2,15 @@ import net.minecraft.core.Direction; -public interface IRedstoneStatementContainer -{ +public interface IRedstoneStatementContainer { /** Get the redstone input from a given side. - * + * * @param side The side - use "null" for maximum input. * @return The redstone input, from 0 to 15. */ int getRedstoneInput(Direction side); /** Set the redstone input for a given side. - * + * * @param side The side - use "null" for all sides. * @return Whether the set was successful. */ boolean setRedstoneOutput(Direction side, int value); diff --git a/api/buildcraft/api/tiles/IControllable.java b/api/buildcraft/api/tiles/IControllable.java index bffb8f4..465097e 100644 --- a/api/buildcraft/api/tiles/IControllable.java +++ b/api/buildcraft/api/tiles/IControllable.java @@ -8,8 +8,7 @@ /** This interface should be implemented by any Tile Entity which wishes to have non-redstone automation (for example, * BuildCraft Gates, but also other mods which implement it, e.g. OpenComputers). */ -public interface IControllable -{ +public interface IControllable { enum Mode { ON, OFF, diff --git a/api/buildcraft/api/tiles/IDebuggable.java b/api/buildcraft/api/tiles/IDebuggable.java index 129f293..62769ad 100644 --- a/api/buildcraft/api/tiles/IDebuggable.java +++ b/api/buildcraft/api/tiles/IDebuggable.java @@ -7,8 +7,7 @@ import java.util.List; -public interface IDebuggable -{ +public interface IDebuggable { /** * Get the debug information from a tile entity as a list of strings, used for the F3 debug menu. The left and * right parameters correspond to the sides of the F3 screen. @@ -25,7 +24,6 @@ public interface IDebuggable * @param side same as for {@link #getDebugInfo(List, List, Direction)} */ @OnlyIn(Dist.CLIENT) - default void getClientDebugInfo(List left, List right, Direction side) - { + default void getClientDebugInfo(List left, List right, Direction side) { } } diff --git a/api/buildcraft/api/tiles/IHasWork.java b/api/buildcraft/api/tiles/IHasWork.java index 4ab940b..5e3b57f 100644 --- a/api/buildcraft/api/tiles/IHasWork.java +++ b/api/buildcraft/api/tiles/IHasWork.java @@ -6,10 +6,9 @@ /** This interface should be implemented by any Tile Entity which carries out work (crafting, ore processing, mining, et * cetera). */ -public interface IHasWork -{ +public interface IHasWork { /** Check if the Tile Entity is currently doing any work. - * + * * @return True if the Tile Entity is doing work. */ boolean hasWork(); } diff --git a/api/buildcraft/api/tiles/IHeatable.java b/api/buildcraft/api/tiles/IHeatable.java index 0d8c1b2..a9eb43c 100644 --- a/api/buildcraft/api/tiles/IHeatable.java +++ b/api/buildcraft/api/tiles/IHeatable.java @@ -5,8 +5,7 @@ package buildcraft.api.tiles; /** This interface should be implemented by Tile Entities which have an internal heat value. */ -public interface IHeatable -{ +public interface IHeatable { /** @return The minimum heat value, in degrees. */ double getMinHeatValue(); @@ -20,7 +19,7 @@ public interface IHeatable double getCurrentHeatValue(); /** Set the heat of the tile. - * + * * @param value Heat value, in degrees. * @return The heat the tile has after the set. */ double setHeatValue(double value); diff --git a/api/buildcraft/api/tiles/ITileAreaProvider.java b/api/buildcraft/api/tiles/ITileAreaProvider.java index a522294..6e5a4c2 100644 --- a/api/buildcraft/api/tiles/ITileAreaProvider.java +++ b/api/buildcraft/api/tiles/ITileAreaProvider.java @@ -5,7 +5,6 @@ import net.minecraft.core.BlockPos; /** Used for more fine-grained control of whether or not a machine connects to the provider here. */ -public interface ITileAreaProvider extends IAreaProvider -{ +public interface ITileAreaProvider extends IAreaProvider { boolean isValidFromLocation(BlockPos pos); } diff --git a/api/buildcraft/api/tiles/TilesAPI.java b/api/buildcraft/api/tiles/TilesAPI.java index 7aee4b3..64a1007 100644 --- a/api/buildcraft/api/tiles/TilesAPI.java +++ b/api/buildcraft/api/tiles/TilesAPI.java @@ -11,26 +11,21 @@ import javax.annotation.Nonnull; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = BCLib.MODID) // Calen add for reg caps -public class TilesAPI -{ +public class TilesAPI { @Nonnull - public static final Capability CAP_CONTROLLABLE = CapabilityManager.get(new CapabilityToken<>() - { + public static final Capability CAP_CONTROLLABLE = CapabilityManager.get(new CapabilityToken<>() { }); @Nonnull - public static final Capability CAP_HAS_WORK = CapabilityManager.get(new CapabilityToken<>() - { + public static final Capability CAP_HAS_WORK = CapabilityManager.get(new CapabilityToken<>() { }); @Nonnull - public static final Capability CAP_HEATABLE = CapabilityManager.get(new CapabilityToken<>() - { + public static final Capability CAP_HEATABLE = CapabilityManager.get(new CapabilityToken<>() { }); @Nonnull - public static final Capability CAP_TILE_AREA_PROVIDER = CapabilityManager.get(new CapabilityToken<>() - { + public static final Capability CAP_TILE_AREA_PROVIDER = CapabilityManager.get(new CapabilityToken<>() { }); // Calen: 1.18.2直接用CapabilityManager.get获取? @@ -43,8 +38,7 @@ public class TilesAPI // Calen @SubscribeEvent - public static void registerCapability(RegisterCapabilitiesEvent event) - { + public static void registerCapability(RegisterCapabilitiesEvent event) { event.register(IControllable.class); event.register(IHasWork.class); event.register(IHeatable.class); diff --git a/api/buildcraft/api/tools/IToolWrench.java b/api/buildcraft/api/tools/IToolWrench.java index ae63a72..34b7e21 100644 --- a/api/buildcraft/api/tools/IToolWrench.java +++ b/api/buildcraft/api/tools/IToolWrench.java @@ -10,8 +10,7 @@ import net.minecraft.world.phys.HitResult; /*** Implement this interface on subclasses of Item to have that item work as a wrench for buildcraft */ -public interface IToolWrench -{ +public interface IToolWrench { /*** Called to ensure that the wrench can be used. * diff --git a/api/buildcraft/api/transport/EnumWirePart.java b/api/buildcraft/api/transport/EnumWirePart.java index 59a3d2f..852fc36 100644 --- a/api/buildcraft/api/transport/EnumWirePart.java +++ b/api/buildcraft/api/transport/EnumWirePart.java @@ -6,8 +6,7 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; -public enum EnumWirePart -{ +public enum EnumWirePart { EAST_UP_SOUTH(true, true, true), EAST_UP_NORTH(true, true, false), EAST_DOWN_SOUTH(true, false, true), @@ -31,8 +30,7 @@ public enum EnumWirePart */ public final VoxelShape boundingBoxPossible; - EnumWirePart(boolean x, boolean y, boolean z) - { + EnumWirePart(boolean x, boolean y, boolean z) { this.x = x ? AxisDirection.POSITIVE : AxisDirection.NEGATIVE; this.y = y ? AxisDirection.POSITIVE : AxisDirection.NEGATIVE; this.z = z ? AxisDirection.POSITIVE : AxisDirection.NEGATIVE; @@ -56,10 +54,8 @@ public enum EnumWirePart ); } - public AxisDirection getDirection(Direction.Axis axis) - { - switch (axis) - { + public AxisDirection getDirection(Direction.Axis axis) { + switch (axis) { case X: return x; case Y: @@ -71,35 +67,27 @@ public AxisDirection getDirection(Direction.Axis axis) } } - public static EnumWirePart get(int x, int y, int z) - { + public static EnumWirePart get(int x, int y, int z) { boolean bx = (x % 2 + 2) % 2 == 1; boolean by = (y % 2 + 2) % 2 == 1; boolean bz = (z % 2 + 2) % 2 == 1; return get(bx, by, bz); } - public static EnumWirePart get(boolean x, boolean y, boolean z) - { - if (x) - { - if (y) - { + public static EnumWirePart get(boolean x, boolean y, boolean z) { + if (x) { + if (y) { return z ? EAST_UP_SOUTH : EAST_UP_NORTH; } - else - { + else { return z ? EAST_DOWN_SOUTH : EAST_DOWN_NORTH; } } - else - { - if (y) - { + else { + if (y) { return z ? WEST_UP_SOUTH : WEST_UP_NORTH; } - else - { + else { return z ? WEST_DOWN_SOUTH : WEST_DOWN_NORTH; } } diff --git a/api/buildcraft/api/transport/IInjectable.java b/api/buildcraft/api/transport/IInjectable.java index 8ff8da4..58da923 100644 --- a/api/buildcraft/api/transport/IInjectable.java +++ b/api/buildcraft/api/transport/IInjectable.java @@ -8,8 +8,7 @@ /** Interface for pipes to implement if they can accept items in a similar fashion to BC pipes. */ -public interface IInjectable -{ +public interface IInjectable { /** Tests to see if this pipe can accept items from the given direction. Useless to call this if you are going to * call {@link #injectItem(ItemStack, boolean, Direction, DyeColor, double)} straight after. */ boolean canInjectItems(Direction from); diff --git a/api/buildcraft/api/transport/IItemPluggable.java b/api/buildcraft/api/transport/IItemPluggable.java index 2a099c5..10daaa2 100644 --- a/api/buildcraft/api/transport/IItemPluggable.java +++ b/api/buildcraft/api/transport/IItemPluggable.java @@ -11,12 +11,11 @@ import javax.annotation.Nullable; /** Designates an item that can be placed onto a pipe as a {@link PipePluggable}. */ -public interface IItemPluggable -{ +public interface IItemPluggable { /** Called when this item is placed onto a pipe holder. This can return null if this item does not make a valid * pluggable. Note that if you return a non-null pluggable then it will *definitely* be added to the pipe, and you * are responsible for making all the effects yourself (like the sound effect). - * + * * @param stack The stack that holds this item * @param holder The pipe holder * @param side The side that the pluggable should be placed on diff --git a/api/buildcraft/api/transport/IStripesHandlerItem.java b/api/buildcraft/api/transport/IStripesHandlerItem.java index ff203ba..e361baa 100644 --- a/api/buildcraft/api/transport/IStripesHandlerItem.java +++ b/api/buildcraft/api/transport/IStripesHandlerItem.java @@ -17,7 +17,7 @@ public interface IStripesHandlerItem { * except that the target stack will be set into its {@link InteractionHand#MAIN_HAND}. Any items left in the players * inventory will be returned back through the activator with * {@link IStripesActivator#sendItem(ItemStack, Direction)} - * + * * @param world * @param pos * @param direction diff --git a/api/buildcraft/api/transport/IWireEmitter.java b/api/buildcraft/api/transport/IWireEmitter.java index 7d84c7f..bf7a844 100644 --- a/api/buildcraft/api/transport/IWireEmitter.java +++ b/api/buildcraft/api/transport/IWireEmitter.java @@ -8,8 +8,7 @@ import net.minecraft.world.item.DyeColor; -public interface IWireEmitter -{ +public interface IWireEmitter { /** Checks to see if this wire emitter is currently emitting the given colour. Only used to check if a given emitter * is still active. */ boolean isEmitting(DyeColor colour); diff --git a/api/buildcraft/api/transport/IWireManager.java b/api/buildcraft/api/transport/IWireManager.java index b4b7a78..c55514f 100644 --- a/api/buildcraft/api/transport/IWireManager.java +++ b/api/buildcraft/api/transport/IWireManager.java @@ -3,8 +3,7 @@ import buildcraft.api.transport.pipe.IPipeHolder; import net.minecraft.world.item.DyeColor; -public interface IWireManager -{ +public interface IWireManager { IPipeHolder getHolder(); diff --git a/api/buildcraft/api/transport/WireNode.java b/api/buildcraft/api/transport/WireNode.java index 2d7eb9e..911b7a6 100644 --- a/api/buildcraft/api/transport/WireNode.java +++ b/api/buildcraft/api/transport/WireNode.java @@ -7,8 +7,7 @@ import java.util.EnumMap; import java.util.Map; -public class WireNode -{ +public class WireNode { public final BlockPos pos; public final EnumWirePart part; private final int hash; @@ -31,7 +30,7 @@ public boolean equals(Object obj) { if (getClass() != obj.getClass()) return false; WireNode other = (WireNode) obj; return part == other.part // - && pos.equals(other.pos); + && pos.equals(other.pos); } @Override @@ -46,7 +45,8 @@ public WireNode offset(Direction face) { EnumWirePart nPart = EnumWirePart.get(nx, ny, nz); if (nx < 0 || ny < 0 || nz < 0 || nx > 1 || ny > 1 || nz > 1) { return new WireNode(pos.relative(face), nPart); - } else { + } + else { return new WireNode(pos, nPart); } } diff --git a/api/buildcraft/api/transport/pipe/EnumPipeColourType.java b/api/buildcraft/api/transport/pipe/EnumPipeColourType.java index 3a6b3f2..ccf2a9b 100644 --- a/api/buildcraft/api/transport/pipe/EnumPipeColourType.java +++ b/api/buildcraft/api/transport/pipe/EnumPipeColourType.java @@ -1,7 +1,6 @@ package buildcraft.api.transport.pipe; -public enum EnumPipeColourType -{ +public enum EnumPipeColourType { TRANSLUCENT, BORDER_OUTER, BORDER_INNER, diff --git a/api/buildcraft/api/transport/pipe/ICustomPipeConnection.java b/api/buildcraft/api/transport/pipe/ICustomPipeConnection.java index ab52ddc..30d9da9 100644 --- a/api/buildcraft/api/transport/pipe/ICustomPipeConnection.java +++ b/api/buildcraft/api/transport/pipe/ICustomPipeConnection.java @@ -5,8 +5,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; -public interface ICustomPipeConnection -{ +public interface ICustomPipeConnection { /** @return How long the connecting pipe should extend for, in addition to its normal 4/16f connection. Values less * than or equal to -4 / 16.0f indicate that the pipe will not connect at all, and will render * as it it was not connected. */ diff --git a/api/buildcraft/api/transport/pipe/IFlowFluid.java b/api/buildcraft/api/transport/pipe/IFlowFluid.java index 55438d0..2906308 100644 --- a/api/buildcraft/api/transport/pipe/IFlowFluid.java +++ b/api/buildcraft/api/transport/pipe/IFlowFluid.java @@ -11,15 +11,13 @@ import javax.annotation.Nullable; -public interface IFlowFluid -{ +public interface IFlowFluid { /** * @deprecated use the version below with a simulate paramater. */ @Nullable @Deprecated - default FluidStack tryExtractFluid(int millibuckets, Direction from, FluidStack filter) - { + default FluidStack tryExtractFluid(int millibuckets, Direction from, FluidStack filter) { // return tryExtractFluid(millibuckets, from, filter, false); return tryExtractFluid(millibuckets, from, filter, IFluidHandler.FluidAction.EXECUTE); } @@ -38,8 +36,7 @@ default FluidStack tryExtractFluid(int millibuckets, Direction from, FluidStack * @deprecated use the version below with a simulate paramater. */ @Deprecated - default InteractionResultHolder tryExtractFluidAdv(int millibuckets, Direction from, IFluidFilter filter) - { + default InteractionResultHolder tryExtractFluidAdv(int millibuckets, Direction from, IFluidFilter filter) { // return tryExtractFluidAdv(millibuckets, from, filter, false); return tryExtractFluidAdv(millibuckets, from, filter, IFluidHandler.FluidAction.EXECUTE); } diff --git a/api/buildcraft/api/transport/pipe/IFlowItems.java b/api/buildcraft/api/transport/pipe/IFlowItems.java index 239d2ea..ec032f0 100644 --- a/api/buildcraft/api/transport/pipe/IFlowItems.java +++ b/api/buildcraft/api/transport/pipe/IFlowItems.java @@ -18,7 +18,7 @@ default int tryExtractItems(int count, Direction from, @Nullable DyeColor colour } /** Attempts to extract items from the inventory connected to this pipe on the given side. - * + * * @param count The maximum number of items to extract * @param from The direction to extract from. * @param colour The colour that extracted items should be painted. @@ -30,7 +30,7 @@ default int tryExtractItems(int count, Direction from, @Nullable DyeColor colour /** Inserts an item directly into the centre of this pipe, going in the given direction. This should ONLY be called * from an instance of {@link PipeBehaviour}, as otherwise it can lead to problems. (For example crashing if a pipe * contains an item that the pipe behaviour doesn't expect). - * + * * @param stack ItemStack offered for addition. Do not manipulate this! * @param from Orientation the ItemStack should pretend to be coming from. * @param colour The colour of the item to be added to the pipe, or null for no colour. diff --git a/api/buildcraft/api/transport/pipe/IFlowPower.java b/api/buildcraft/api/transport/pipe/IFlowPower.java index a425108..4b33292 100644 --- a/api/buildcraft/api/transport/pipe/IFlowPower.java +++ b/api/buildcraft/api/transport/pipe/IFlowPower.java @@ -8,7 +8,7 @@ public interface IFlowPower { void reconfigure(); /** Attempts to extract power from the {@link IMjPassiveProvider} connected to this pipe on the given side. - * + * * @param maxPower The Maximum amount of power that can be extracted. * @param from The side (of this pipe) to take power from. * @return The amount of power extracted. */ diff --git a/api/buildcraft/api/transport/pipe/IItemPipe.java b/api/buildcraft/api/transport/pipe/IItemPipe.java index bbded7b..e5a7004 100644 --- a/api/buildcraft/api/transport/pipe/IItemPipe.java +++ b/api/buildcraft/api/transport/pipe/IItemPipe.java @@ -6,8 +6,7 @@ /** To be implemented by the real item pipe in Transport mod, but leaves knowledge for classes that do not have direct * dependency on transport. */ -public interface IItemPipe -{ +public interface IItemPipe { PipeDefinition getDefinition(); // Calen diff --git a/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java b/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java index a8e1a45..0fca004 100644 --- a/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java +++ b/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java @@ -7,7 +7,7 @@ @OnlyIn(Dist.CLIENT) public interface IPipeBehaviourRenderer { -// void render(B behaviour, double x, double y, double z, float partialTicks, BufferBuilder bb); + // void render(B behaviour, double x, double y, double z, float partialTicks, BufferBuilder bb); // public void render(B gate, float partialTicks, PoseStack poseStack, MultiBufferSource bufferSource, int combinedLight, int combinedOverlay); public void render(B gate, float partialTicks, PoseStack poseStack, VertexConsumer vertexConsumer, int combinedLight, int combinedOverlay); } diff --git a/api/buildcraft/api/transport/pipe/IPipeHolder.java b/api/buildcraft/api/transport/pipe/IPipeHolder.java index dbb2374..65fef67 100644 --- a/api/buildcraft/api/transport/pipe/IPipeHolder.java +++ b/api/buildcraft/api/transport/pipe/IPipeHolder.java @@ -20,8 +20,7 @@ /** * Designates a tile that can contain a pipe, up to 6 sided pluggables. */ -public interface IPipeHolder extends IRedstoneStatementContainer, MenuProvider -{ +public interface IPipeHolder extends IRedstoneStatementContainer, MenuProvider { Level getPipeWorld(); BlockPos getPipePos(); @@ -114,8 +113,7 @@ public interface IPipeHolder extends IRedstoneStatementContainer, MenuProvider */ void onPlayerClose(Player player); - enum PipeMessageReceiver - { + enum PipeMessageReceiver { BEHAVIOUR(null), FLOW(null), PLUGGABLE_DOWN(Direction.DOWN), @@ -130,12 +128,9 @@ enum PipeMessageReceiver public static final PipeMessageReceiver[] VALUES = values(); public static final PipeMessageReceiver[] PLUGGABLES = new PipeMessageReceiver[6]; - static - { - for (PipeMessageReceiver type : VALUES) - { - if (type.face != null) - { + static { + for (PipeMessageReceiver type : VALUES) { + if (type.face != null) { PLUGGABLES[type.face.ordinal()] = type; } } @@ -143,14 +138,12 @@ enum PipeMessageReceiver public final Direction face; - PipeMessageReceiver(Direction face) - { + PipeMessageReceiver(Direction face) { this.face = face; } } - interface IWriter - { + interface IWriter { void write(FriendlyByteBuf buffer); } } diff --git a/api/buildcraft/api/transport/pipe/IPipeRegistry.java b/api/buildcraft/api/transport/pipe/IPipeRegistry.java index 94ce325..02aa579 100644 --- a/api/buildcraft/api/transport/pipe/IPipeRegistry.java +++ b/api/buildcraft/api/transport/pipe/IPipeRegistry.java @@ -6,8 +6,7 @@ import java.util.Map; -public interface IPipeRegistry -{ +public interface IPipeRegistry { PipeDefinition getDefinition(ResourceLocation identifier); void registerPipe(PipeDefinition definition); diff --git a/api/buildcraft/api/transport/pipe/PipeApi.java b/api/buildcraft/api/transport/pipe/PipeApi.java index 629378c..73d1319 100644 --- a/api/buildcraft/api/transport/pipe/PipeApi.java +++ b/api/buildcraft/api/transport/pipe/PipeApi.java @@ -1,6 +1,6 @@ package buildcraft.api.transport.pipe; -import buildcraft.api.mj.*; +import buildcraft.api.mj.MjAPI; import buildcraft.api.transport.IInjectable; import buildcraft.api.transport.IStripesRegistry; import buildcraft.api.transport.pluggable.IPluggableRegistry; @@ -19,8 +19,7 @@ /** The central holding class for all pipe related registers and methods. */ @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = BCLib.MODID) // Calen add for reg caps -public final class PipeApi -{ +public final class PipeApi { public static IPipeRegistry pipeRegistry; public static IPluggableRegistry pluggableRegistry; public static IStripesRegistry stripeRegistry; @@ -42,22 +41,27 @@ public final class PipeApi public static final Map powerTransferData = new IdentityHashMap<>(); @Nonnull - public static final Capability CAP_PIPE_HOLDER = CapabilityManager.get(new CapabilityToken<>(){}); + public static final Capability CAP_PIPE_HOLDER = CapabilityManager.get(new CapabilityToken<>() { + }); @Nonnull - public static final Capability CAP_PIPE = CapabilityManager.get(new CapabilityToken<>(){}); + public static final Capability CAP_PIPE = CapabilityManager.get(new CapabilityToken<>() { + }); @Nonnull - public static final Capability CAP_PLUG = CapabilityManager.get(new CapabilityToken<>(){}); + public static final Capability CAP_PLUG = CapabilityManager.get(new CapabilityToken<>() { + }); @Nonnull - public static final Capability CAP_INJECTABLE = CapabilityManager.get(new CapabilityToken<>(){}); + public static final Capability CAP_INJECTABLE = CapabilityManager.get(new CapabilityToken<>() { + }); public static FluidTransferInfo getFluidTransferInfo(PipeDefinition def) { FluidTransferInfo info = fluidTransferData.get(def); if (info == null) { return fluidInfoDefault; - } else { + } + else { return info; } } @@ -66,7 +70,8 @@ public static PowerTransferInfo getPowerTransferInfo(PipeDefinition def) { PowerTransferInfo info = powerTransferData.get(def); if (info == null) { return powerInfoDefault; - } else { + } + else { return info; } } @@ -98,7 +103,7 @@ public static class PowerTransferInfo { public final boolean isReceiver; /** Sets resistancePerTick to be equal to lossPerTick when full power is being transferred, scaling down to 0. - * + * * @param transferPerTick * @param lossPerTick * @param isReceiver */ @@ -107,7 +112,7 @@ public static PowerTransferInfo createFromLoss(long transferPerTick, long lossPe } /** Sets lossPerTick to be equal to resistancePerTick when full power is being transferred. - * + * * @param transferPerTick * @param resistancePerTick * @param isReceiver */ @@ -137,8 +142,7 @@ public PowerTransferInfo(long transferPerTick, long lossPerTick, long resistance // Calen @SubscribeEvent - public static void registerCapability(RegisterCapabilitiesEvent event) - { + public static void registerCapability(RegisterCapabilitiesEvent event) { event.register(IPipe.class); event.register(PipePluggable.class); event.register(IPipeHolder.class); diff --git a/api/buildcraft/api/transport/pipe/PipeApiClient.java b/api/buildcraft/api/transport/pipe/PipeApiClient.java index c6ac351..b1d78d9 100644 --- a/api/buildcraft/api/transport/pipe/PipeApiClient.java +++ b/api/buildcraft/api/transport/pipe/PipeApiClient.java @@ -22,11 +22,11 @@ public interface IClientRegistry { /** Registers a dynamic renderer for the given pipe behaviour. Most {@link PipeBehaviour} types will have no use * for this. */ void registerRenderer(Class behaviourClass, - IPipeBehaviourRenderer renderer); + IPipeBehaviourRenderer renderer);

    void registerRenderer(Class plugClass, IPlugDynamicRenderer

    renderer);

    void registerBaker(Class keyClass, - IPluggableStaticBaker

    renderer); + IPluggableStaticBaker

    renderer); } } diff --git a/api/buildcraft/api/transport/pipe/PipeBehaviour.java b/api/buildcraft/api/transport/pipe/PipeBehaviour.java index 05c6f48..dfa76b1 100644 --- a/api/buildcraft/api/transport/pipe/PipeBehaviour.java +++ b/api/buildcraft/api/transport/pipe/PipeBehaviour.java @@ -37,10 +37,12 @@ public CompoundTag writeToNbt() { return nbt; } - public void writePayload(FriendlyByteBuf buffer, Dist side) {} + public void writePayload(FriendlyByteBuf buffer, Dist side) { + } -// public void readPayload(FriendlyByteBuf buffer, Dist side, MessageContext ctx) throws IOException {} - public void readPayload(FriendlyByteBuf buffer, NetworkDirection side, NetworkEvent.Context ctx) throws IOException{} + // public void readPayload(FriendlyByteBuf buffer, Dist side, MessageContext ctx) throws IOException {} + public void readPayload(FriendlyByteBuf buffer, NetworkDirection side, NetworkEvent.Context ctx) throws IOException { + } /** @deprecated Replaced by {@link #getTextureData(Direction)}. */ @Deprecated @@ -72,9 +74,11 @@ public boolean onPipeActivate(Player player, HitResult trace, float hitX, float return false; } - public void onEntityCollide(Entity entity) {} + public void onEntityCollide(Entity entity) { + } - public void onTick() {} + public void onTick() { + } // Calen: getCapability(...).isPresent() // @Override @@ -89,5 +93,6 @@ public LazyOptional getCapability(@Nonnull Capability capability, Dire return LazyOptional.empty(); } - public void addDrops(NonNullList toDrop, int fortune) {} + public void addDrops(NonNullList toDrop, int fortune) { + } } diff --git a/api/buildcraft/api/transport/pipe/PipeConnectionAPI.java b/api/buildcraft/api/transport/pipe/PipeConnectionAPI.java index 709eb12..28277d1 100644 --- a/api/buildcraft/api/transport/pipe/PipeConnectionAPI.java +++ b/api/buildcraft/api/transport/pipe/PipeConnectionAPI.java @@ -14,7 +14,7 @@ public final class PipeConnectionAPI { /** Register a core with a custom connection. Useful if you don't own the core class or are adding it for some-one * else. - * + * * @param block The core instance * @param connection The connection instance */ public static void registerConnection(Block block, ICustomPipeConnection connection) { diff --git a/api/buildcraft/api/transport/pipe/PipeDefinition.java b/api/buildcraft/api/transport/pipe/PipeDefinition.java index 8d93f30..b5b2c4a 100644 --- a/api/buildcraft/api/transport/pipe/PipeDefinition.java +++ b/api/buildcraft/api/transport/pipe/PipeDefinition.java @@ -10,8 +10,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -public final class PipeDefinition -{ +public final class PipeDefinition { public final Item.Properties properties; public final ResourceLocation identifier; public final IPipeCreator logicConstructor; @@ -79,7 +78,7 @@ public static class PipeDefinitionBuilder { ; public ResourceLocation identifier; public String texturePrefix; - public String[] textureSuffixes = { "" }; + public String[] textureSuffixes = {""}; public IPipeCreator logicConstructor; public IPipeLoader logicLoader; public PipeFlowType flowType; @@ -91,10 +90,11 @@ public static class PipeDefinitionBuilder { public boolean canBeColoured; public EnumPipeColourType colourType; - public PipeDefinitionBuilder() {} + public PipeDefinitionBuilder() { + } public PipeDefinitionBuilder(ResourceLocation identifier, IPipeCreator logicConstructor, - IPipeLoader logicLoader, PipeFlowType flowType) { + IPipeLoader logicLoader, PipeFlowType flowType) { this.identifier = identifier; this.logicConstructor = logicConstructor; this.logicLoader = logicLoader; @@ -113,7 +113,7 @@ private static String getActiveModId() { ModContainer mod = ModLoadingContext.get().getActiveContainer(); if (mod == null) { throw new IllegalStateException( - "Cannot interact with PipeDefinition outside of an actively scoped mod!"); + "Cannot interact with PipeDefinition outside of an actively scoped mod!"); } return mod.getModId(); } @@ -129,7 +129,7 @@ public PipeDefinitionBuilder tex(String prefix, String... suffixes) { /** Sets the texture prefix to be: [current_mod_id]:pipes/[prefix] where [current_mod_id] is the * modid of the currently loaded mod, and [prefix] is the string parameter given. - * + * * @return this */ public PipeDefinitionBuilder texPrefix(String prefix) { return texPrefixDirect(getActiveModId() + ":pipes/" + prefix); @@ -137,7 +137,7 @@ public PipeDefinitionBuilder texPrefix(String prefix) { /** Sets the {@link #texturePrefix} to the input string, without any additions or changes (unlike * {@link #texPrefix(String)}) - * + * * @return this */ public PipeDefinitionBuilder texPrefixDirect(String prefix) { texturePrefix = prefix; @@ -146,12 +146,13 @@ public PipeDefinitionBuilder texPrefixDirect(String prefix) { /** Sets {@link #textureSuffixes} to the given array, or to {""} if the argument list is empty or * null. - * + * * @return this. */ public PipeDefinitionBuilder texSuffixes(String... suffixes) { if (suffixes == null || suffixes.length == 0) { - textureSuffixes = new String[] { "" }; - } else { + textureSuffixes = new String[]{""}; + } + else { textureSuffixes = suffixes; } return this; diff --git a/api/buildcraft/api/transport/pipe/PipeEvent.java b/api/buildcraft/api/transport/pipe/PipeEvent.java index a874b30..382e9c7 100644 --- a/api/buildcraft/api/transport/pipe/PipeEvent.java +++ b/api/buildcraft/api/transport/pipe/PipeEvent.java @@ -3,8 +3,7 @@ /** The base class for all pipe events. Some event classes can be cancelled with {@link #cancel()}, however this will * only have an effect if {@link #canBeCancelled} is true. Refer to individual classes for information on if they can * be cancelled, and what cancelling the event does. */ -public abstract class PipeEvent -{ +public abstract class PipeEvent { public final boolean canBeCancelled; public final IPipeHolder holder; private boolean canceled = false; diff --git a/api/buildcraft/api/transport/pipe/PipeEventFluid.java b/api/buildcraft/api/transport/pipe/PipeEventFluid.java index 7450be3..3e74bfe 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventFluid.java +++ b/api/buildcraft/api/transport/pipe/PipeEventFluid.java @@ -58,7 +58,7 @@ public static class PreMoveToCentre extends PipeEventFluid { public final int[] actuallyOffered; public PreMoveToCentre(IPipeHolder holder, IFlowFluid flow, FluidStack fluid, int totalAcceptable, - int[] totalOffered, int[] actuallyOffered) { + int[] totalOffered, int[] actuallyOffered) { super(holder, flow); this.fluid = fluid; this.totalAcceptable = totalAcceptable; @@ -75,7 +75,7 @@ public String checkStateForErrors() { } if (actuallyOffered[i] > totalOffered[i]) { return "actuallyOffered[" + i + "](=" + actuallyOffered[i] - + ") shouldn't be greater than totalOffered[" + i + "](=" + totalOffered[i] + ")"; + + ") shouldn't be greater than totalOffered[" + i + "](=" + totalOffered[i] + ")"; } } return super.checkStateForErrors(); @@ -95,7 +95,7 @@ public static class OnMoveToCentre extends PipeEventFluid { private final int[] fluidLeaveCheck, fluidEnterCheck; public OnMoveToCentre(IPipeHolder holder, IFlowFluid flow, FluidStack fluid, int[] fluidLeavingSide, - int[] fluidEnteringCentre) { + int[] fluidEnteringCentre) { super(holder, flow); this.fluid = fluid; this.fluidLeavingSide = fluidLeavingSide; @@ -109,15 +109,15 @@ public String checkStateForErrors() { for (int i = 0; i < fluidLeavingSide.length; i++) { if (fluidLeavingSide[i] > fluidLeaveCheck[i]) { return "fluidLeavingSide[" + i + "](=" + fluidLeavingSide[i] - + ") shouldn't be bigger than its original value!(=" + fluidLeaveCheck[i] + ")"; + + ") shouldn't be bigger than its original value!(=" + fluidLeaveCheck[i] + ")"; } if (fluidEnteringCentre[i] > fluidEnterCheck[i]) { return "fluidEnteringCentre[" + i + "](=" + fluidEnteringCentre[i] - + ") shouldn't be bigger than its original value!(=" + fluidEnterCheck[i] + ")"; + + ") shouldn't be bigger than its original value!(=" + fluidEnterCheck[i] + ")"; } if (fluidEnteringCentre[i] > fluidLeavingSide[i]) { return "fluidEnteringCentre[" + i + "](=" + fluidEnteringCentre[i] - + ") shouldn't be bigger than fluidLeavingSide[" + i + "](=" + fluidLeavingSide[i] + ")"; + + ") shouldn't be bigger than fluidLeavingSide[" + i + "](=" + fluidLeavingSide[i] + ")"; } } return super.checkStateForErrors(); @@ -160,7 +160,8 @@ public void disallowAllExcept(Direction side) { if (allowed.contains(side)) { allowed.clear(); allowed.add(side); - } else { + } + else { allowed.clear(); } } @@ -229,7 +230,8 @@ public EnumSet getOrder() { if (allowed.size() == 1) { return allowed; } - priority_search: { + priority_search: + { int val = priority[0]; for (int i = 1; i < priority.length; i++) { if (priority[i] != val) { diff --git a/api/buildcraft/api/transport/pipe/PipeEventHandler.java b/api/buildcraft/api/transport/pipe/PipeEventHandler.java index 15eaeca..44d9424 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventHandler.java +++ b/api/buildcraft/api/transport/pipe/PipeEventHandler.java @@ -9,11 +9,11 @@ * extends {@link PipeEvent}.
    * An example is:
    * - @PipeEventHandler
    - public void sideCheck(PipeEventItem.SideCheck sideCheck) {
    - // Logic omitted
    - } - * + @PipeEventHandler
    + public void sideCheck(PipeEventItem.SideCheck sideCheck) {
    + // Logic omitted
    + } + * *
    */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) diff --git a/api/buildcraft/api/transport/pipe/PipeEventItem.java b/api/buildcraft/api/transport/pipe/PipeEventItem.java index 86a3fbf..9f7562b 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventItem.java +++ b/api/buildcraft/api/transport/pipe/PipeEventItem.java @@ -81,7 +81,8 @@ public ItemStack getStack() { public void setStack(ItemStack stack) { if (stack == null) { throw new NullPointerException("stack"); - } else { + } + else { this.stack = stack; } } @@ -149,7 +150,8 @@ public ItemStack getExcess() { public void setExcess(ItemStack stack) { if (stack == null) { throw new NullPointerException("stack"); - } else { + } + else { this.excess = stack; } } @@ -159,7 +161,7 @@ public static class IntoPipe extends Ejected { public final IFlowItems otherPipe; public IntoPipe(IPipeHolder holder, IFlowItems flow, ItemStack inserted, ItemStack excess, Direction to, - IFlowItems otherPipe) { + IFlowItems otherPipe) { super(holder, flow, inserted, excess, to); this.otherPipe = otherPipe; } @@ -170,7 +172,7 @@ public static class IntoTile extends Ejected { public final BlockEntity tile; public IntoTile(IPipeHolder holder, IFlowItems flow, ItemStack inserted, ItemStack excess, Direction to, - BlockEntity tile) { + BlockEntity tile) { super(holder, flow, inserted, excess, to); this.tile = tile; } @@ -256,7 +258,8 @@ public List> getOrder() { return ImmutableList.of(allowed); default: } - priority_search: { + priority_search: + { int val = priority[0]; for (int i = 1; i < priority.length; i++) { if (priority[i] != val) { @@ -328,9 +331,11 @@ public ItemStack getStack() { public void setStack(ItemStack stack) { if (stack == null) { throw new NullPointerException("stack"); - } else if (stack.isEmpty()) { + } + else if (stack.isEmpty()) { entity.setItem(ItemStack.EMPTY); - } else { + } + else { entity.setItem(stack); } } @@ -388,7 +393,7 @@ public static class FindDest extends OrderedEvent { public final ImmutableList items; public FindDest(IPipeHolder holder, IFlowItems flow, List> orderedDestinations, - ImmutableList items) { + ImmutableList items) { super(holder, flow, orderedDestinations); this.items = items; } diff --git a/api/buildcraft/api/transport/pipe/PipeFaceTex.java b/api/buildcraft/api/transport/pipe/PipeFaceTex.java index 8506d4e..b912510 100644 --- a/api/buildcraft/api/transport/pipe/PipeFaceTex.java +++ b/api/buildcraft/api/transport/pipe/PipeFaceTex.java @@ -2,8 +2,7 @@ import java.util.Arrays; -public class PipeFaceTex -{ +public class PipeFaceTex { private static final int SINGLE_WHITE_SPRITES_COUNT = 64; private static final PipeFaceTex[] SINGLE_WHITE_SPRITES; @@ -63,10 +62,12 @@ private PipeFaceTex(int[] textures, int... colours) { } if (textures.length == 0) { hash = -1; - } else if (textures.length == 1) { + } + else if (textures.length == 1) { // If the colour is -1 then this will equal the hash below hash = textures[0] + getColour(0) + 1; - } else { + } + else { int[] cArr = colours; { int prevLength = cArr.length; @@ -87,7 +88,7 @@ private PipeFaceTex(int... textures) { } private PipeFaceTex(int singleTexture) { - textures = new int[] { singleTexture }; + textures = new int[]{singleTexture}; colours = EMPTY_INT_ARRAY; hash = singleTexture; } @@ -121,7 +122,7 @@ public boolean equals(Object obj) { if (!Arrays.equals(textures, other.textures)) { return false; } - for (int i = textures.length; i > 0;) { + for (int i = textures.length; i > 0; ) { i--; if (getColour(i) != other.getColour(i)) { return false; diff --git a/api/buildcraft/api/transport/pipe/PipeFlow.java b/api/buildcraft/api/transport/pipe/PipeFlow.java index b44c6cc..24f90d3 100644 --- a/api/buildcraft/api/transport/pipe/PipeFlow.java +++ b/api/buildcraft/api/transport/pipe/PipeFlow.java @@ -20,8 +20,7 @@ import javax.annotation.Nonnull; import java.io.IOException; -public abstract class PipeFlow implements ICapabilityProvider -{ +public abstract class PipeFlow implements ICapabilityProvider { /** * The ID for completely refreshing the state of this flow. */ @@ -34,43 +33,36 @@ public abstract class PipeFlow implements ICapabilityProvider public final IPipe pipe; - public PipeFlow(IPipe pipe) - { + public PipeFlow(IPipe pipe) { this.pipe = pipe; } - public PipeFlow(IPipe pipe, CompoundTag nbt) - { + public PipeFlow(IPipe pipe, CompoundTag nbt) { this.pipe = pipe; } - public CompoundTag writeToNbt() - { + public CompoundTag writeToNbt() { return new CompoundTag(); } /** * Writes a payload with the specified id. Standard ID's are NET_ID_FULL_STATE and NET_ID_UPDATE. */ - public void writePayload(int id, FriendlyByteBuf buffer, Dist side) - { + public void writePayload(int id, FriendlyByteBuf buffer, Dist side) { } /** * Reads a payload with the specified id. Standard ID's are NET_ID_FULL_STATE and NET_ID_UPDATE. */ - public void readPayload(int id, FriendlyByteBuf buffer, NetworkDirection side) throws IOException - { + public void readPayload(int id, FriendlyByteBuf buffer, NetworkDirection side) throws IOException { } - public void sendPayload(int id) - { + public void sendPayload(int id) { final Dist side = pipe.getHolder().getPipeWorld().isClientSide ? Dist.CLIENT : Dist.DEDICATED_SERVER; sendCustomPayload(id, (buf) -> writePayload(id, buf, side)); } - public final void sendCustomPayload(int id, IWriter writer) - { + public final void sendCustomPayload(int id, IWriter writer) { pipe.getHolder().sendMessage(PipeMessageReceiver.FLOW, buffer -> { buffer.writeBoolean(true); @@ -87,22 +79,18 @@ public final void sendCustomPayload(int id, IWriter writer) * Used to force a connection to a given tile, even if the {@link PipeBehaviour} wouldn't normally connect to * it. */ - public boolean shouldForceConnection(Direction face, BlockEntity oTile) - { + public boolean shouldForceConnection(Direction face, BlockEntity oTile) { return false; } - public void onTick() - { + public void onTick() { } - public void addDrops(NonNullList toDrop, int fortune) - { + public void addDrops(NonNullList toDrop, int fortune) { } public boolean onFlowActivate(Player player, HitResult trace, float hitX, float hitY, float hitZ, - EnumPipePart part) - { + EnumPipePart part) { return false; } @@ -114,8 +102,7 @@ public boolean onFlowActivate(Player player, HitResult trace, float hitX, float // } @Override - public LazyOptional getCapability(@Nonnull Capability capability, Direction facing) - { + public LazyOptional getCapability(@Nonnull Capability capability, Direction facing) { return LazyOptional.empty(); } } diff --git a/api/buildcraft/api/transport/pipe/PipeFlowType.java b/api/buildcraft/api/transport/pipe/PipeFlowType.java index c247206..2cb320f 100644 --- a/api/buildcraft/api/transport/pipe/PipeFlowType.java +++ b/api/buildcraft/api/transport/pipe/PipeFlowType.java @@ -2,8 +2,7 @@ import net.minecraft.nbt.CompoundTag; -public final class PipeFlowType -{ +public final class PipeFlowType { public final IFlowCreator creator; public final IFlowLoader loader; diff --git a/api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java b/api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java index 18664dc..82f963b 100644 --- a/api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java +++ b/api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java @@ -5,6 +5,6 @@ import com.mojang.blaze3d.vertex.VertexConsumer; public interface IPlugDynamicRenderer

    { -// void render(P plug, double x, double y, double z, float partialTicks, VertexConsumer bb); + // void render(P plug, double x, double y, double z, float partialTicks, VertexConsumer bb); void render(P gate, float partialTicks, PoseStack poseStack, VertexConsumer vertexConsumer, int combinedLight, int combinedOverlay); } diff --git a/api/buildcraft/api/transport/pluggable/PipePluggable.java b/api/buildcraft/api/transport/pluggable/PipePluggable.java index 5d6d91b..49e3d7c 100644 --- a/api/buildcraft/api/transport/pluggable/PipePluggable.java +++ b/api/buildcraft/api/transport/pluggable/PipePluggable.java @@ -27,21 +27,18 @@ import javax.annotation.Nullable; import java.io.IOException; -public abstract class PipePluggable -{ +public abstract class PipePluggable { public final PluggableDefinition definition; public final IPipeHolder holder; public final Direction side; - public PipePluggable(PluggableDefinition definition, IPipeHolder holder, Direction side) - { + public PipePluggable(PluggableDefinition definition, IPipeHolder holder, Direction side) { this.definition = definition; this.holder = holder; this.side = side; } - public CompoundTag writeToNbt() - { + public CompoundTag writeToNbt() { CompoundTag nbt = new CompoundTag(); return nbt; } @@ -51,28 +48,23 @@ public CompoundTag writeToNbt() * {@link PluggableDefinition#loadFromBuffer(IPipeHolder, Direction, FriendlyByteBuf)} on the client. (This is called * on the server and sent to the client). Note that this will be called *instead* of write and read payload. */ - public void writeCreationPayload(FriendlyByteBuf buffer) - { + public void writeCreationPayload(FriendlyByteBuf buffer) { } - public void writePayload(FriendlyByteBuf buffer, Dist side) - { + public void writePayload(FriendlyByteBuf buffer, Dist side) { } - public void readPayload(FriendlyByteBuf buffer, NetworkDirection side, NetworkEvent.Context ctx) throws IOException - { + public void readPayload(FriendlyByteBuf buffer, NetworkDirection side, NetworkEvent.Context ctx) throws IOException { } - public final void scheduleNetworkUpdate() - { + public final void scheduleNetworkUpdate() { holder.scheduleNetworkUpdate(IPipeHolder.PipeMessageReceiver.PLUGGABLES[side.ordinal()]); } - public void onTick() - { + public void onTick() { } /** @@ -83,8 +75,7 @@ public void onTick() /** * @return True if the pipe cannot connect outwards (it is blocked), or False if this does not core the pipe. */ - public boolean isBlocking() - { + public boolean isBlocking() { return false; } @@ -94,8 +85,7 @@ public boolean isBlocking() * {@link ICapabilityProvider#hasCapability(Capability, Direction)} will return true when this returns a non-null * value. */ - public LazyOptional getCapability(@Nonnull Capability cap) - { + public LazyOptional getCapability(@Nonnull Capability cap) { return LazyOptional.empty(); } @@ -105,26 +95,22 @@ public LazyOptional getCapability(@Nonnull Capability cap) * @param cap * @return */ - public T getInternalCapability(@Nonnull Capability cap) - { + public T getInternalCapability(@Nonnull Capability cap) { return null; } /** * Called whenever this pluggable is removed from the pipe. */ - public void onRemove() - { + public void onRemove() { } /** * @param toDrop A list containing all the items to drop (so you should add your items to this list) */ - public void addDrops(NonNullList toDrop, int fortune) - { + public void addDrops(NonNullList toDrop, int fortune) { ItemStack stack = getPickStack(); - if (!stack.isEmpty()) - { + if (!stack.isEmpty()) { toDrop.add(stack); } } @@ -134,20 +120,17 @@ public void addDrops(NonNullList toDrop, int fortune) * * @return The stack that should be picked, or ItemStack.EMPTY if no stack can be picked from this pluggable. */ - public ItemStack getPickStack() - { + public ItemStack getPickStack() { return ItemStack.EMPTY; } - public boolean onPluggableActivate(Player player, HitResult trace, float hitX, float hitY, float hitZ) - { + public boolean onPluggableActivate(Player player, HitResult trace, float hitX, float hitY, float hitZ) { return false; } @OnlyIn(Dist.CLIENT) @Nullable - public PluggableModelKey getModelRenderKey(RenderType layer) - { + public PluggableModelKey getModelRenderKey(RenderType layer) { return null; } @@ -158,8 +141,7 @@ public PluggableModelKey getModelRenderKey(RenderType layer) * @return The tint index to render the quad with, or -1 for default. */ @OnlyIn(Dist.CLIENT) - public int getBlockColor(int tintIndex) - { + public int getBlockColor(int tintIndex) { return -1; } @@ -167,8 +149,7 @@ public int getBlockColor(int tintIndex) * PipePluggable version of * {@link Block#canBeConnectedTo(net.minecraft.world.level.LevelAccessor, BlockPos, Direction)}. */ - public boolean canBeConnected() - { + public boolean canBeConnected() { return false; } @@ -176,8 +157,7 @@ public boolean canBeConnected() * PipePluggable version of * {@link BlockState#isSideSolid(IBlockAccess, BlockPos, Direction)} */ - public boolean isSideSolid() - { + public boolean isSideSolid() { return false; } @@ -185,13 +165,11 @@ public boolean isSideSolid() * PipePluggable version of {@link Block#getExplosionResistance(Level, BlockPos, Entity, Explosion)} */ // public float getExplosionResistance(@Nullable Entity exploder, Explosion explosion) - public float getExplosionResistance(@Nonnull Entity exploder, Explosion explosion) - { + public float getExplosionResistance(@Nonnull Entity exploder, Explosion explosion) { return 0; } - public boolean canConnectToRedstone(@Nullable Direction to) - { + public boolean canConnectToRedstone(@Nullable Direction to) { return false; } @@ -207,8 +185,7 @@ public boolean canConnectToRedstone(@Nullable Direction to) // return SupportType.FULL; // } - public void onPlacedBy(Player player) - { + public void onPlacedBy(Player player) { } } diff --git a/api/buildcraft/api/transport/pluggable/PluggableDefinition.java b/api/buildcraft/api/transport/pluggable/PluggableDefinition.java index cba05b3..5cb5fe8 100644 --- a/api/buildcraft/api/transport/pluggable/PluggableDefinition.java +++ b/api/buildcraft/api/transport/pluggable/PluggableDefinition.java @@ -9,8 +9,7 @@ import javax.annotation.Nullable; -public final class PluggableDefinition -{ +public final class PluggableDefinition { public final ResourceLocation identifier; public final IPluggableNetLoader loader; @@ -38,7 +37,7 @@ public PipePluggable readFromNbt(IPipeHolder holder, Direction side, CompoundTag } public PipePluggable loadFromBuffer(IPipeHolder holder, Direction side, FriendlyByteBuf buffer) - throws InvalidInputDataException { + throws InvalidInputDataException { return loader.loadFromBuffer(this, holder, side, buffer); } @@ -48,26 +47,26 @@ public interface IPluggableNbtReader { * exception if the wrong data is given) this should make a best effort to read the pluggable from nbt, or fall * back to sensible defaults. */ PipePluggable readFromNbt(PluggableDefinition definition, IPipeHolder holder, Direction side, - CompoundTag nbt); + CompoundTag nbt); } @FunctionalInterface public interface IPluggableNetLoader { PipePluggable loadFromBuffer(PluggableDefinition definition, IPipeHolder holder, Direction side, - FriendlyByteBuf buffer) throws InvalidInputDataException; + FriendlyByteBuf buffer) throws InvalidInputDataException; } @FunctionalInterface public interface IPluggableCreator extends IPluggableNbtReader, IPluggableNetLoader { @Override default PipePluggable loadFromBuffer(PluggableDefinition definition, IPipeHolder holder, Direction side, - FriendlyByteBuf buffer) { + FriendlyByteBuf buffer) { return createSimplePluggable(definition, holder, side); } @Override default PipePluggable readFromNbt(PluggableDefinition definition, IPipeHolder holder, Direction side, - CompoundTag nbt) { + CompoundTag nbt) { return createSimplePluggable(definition, holder, side); } diff --git a/api/buildcraft/api/transport/pluggable/PluggableModelKey.java b/api/buildcraft/api/transport/pluggable/PluggableModelKey.java index 0350616..83525c0 100644 --- a/api/buildcraft/api/transport/pluggable/PluggableModelKey.java +++ b/api/buildcraft/api/transport/pluggable/PluggableModelKey.java @@ -5,8 +5,7 @@ import java.util.Objects; -public abstract class PluggableModelKey -{ +public abstract class PluggableModelKey { public final RenderType layer; public final Direction side; private final int hash; From e7d67d8e76165946c056bb8ad7ec5fcf6ca5926e Mon Sep 17 00:00:00 2001 From: LRW-Calen Date: Sat, 20 Apr 2024 22:11:53 +0800 Subject: [PATCH 05/20] A few updates --- .../api/blocks/CustomPaintHelper.java | 6 ++-- .../api/core/CapabilitiesHelper.java | 30 +++++++------------ api/buildcraft/api/mj/MjAPI.java | 2 +- .../api/recipes/AssemblyRecipe.java | 2 +- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/api/buildcraft/api/blocks/CustomPaintHelper.java b/api/buildcraft/api/blocks/CustomPaintHelper.java index a73ae56..9e18612 100644 --- a/api/buildcraft/api/blocks/CustomPaintHelper.java +++ b/api/buildcraft/api/blocks/CustomPaintHelper.java @@ -53,7 +53,7 @@ public void registerHandlerForAll(Class blockClass, ICustomPain Class foundClass = block.getClass(); if (blockClass.isAssignableFrom(foundClass)) { if (DEBUG) { - BCLog.logger.info("[api.painting] Found an assignable core " + block.getRegistryName() + " (" + foundClass + ") for " + blockClass); + BCLog.logger.info("[api.painting] Found an assignable block " + block.getRegistryName() + " (" + foundClass + ") for " + blockClass); } registerHandlerInternal(block, handler); } @@ -63,11 +63,11 @@ public void registerHandlerForAll(Class blockClass, ICustomPain public void registerHandler(Block block, ICustomPaintHandler handler) { if (registerHandlerInternal(block, handler)) { if (DEBUG) { - BCLog.logger.info("[api.painting] Setting a paint handler for core " + block.getRegistryName() + "(" + handler.getClass() + ")"); + BCLog.logger.info("[api.painting] Setting a paint handler for block " + block.getRegistryName() + "(" + handler.getClass() + ")"); } } else if (DEBUG) { - BCLog.logger.info("[api.painting] Adding another paint handler for core " + block.getRegistryName() + "(" + handler.getClass() + ")"); + BCLog.logger.info("[api.painting] Adding another paint handler for block " + block.getRegistryName() + "(" + handler.getClass() + ")"); } } diff --git a/api/buildcraft/api/core/CapabilitiesHelper.java b/api/buildcraft/api/core/CapabilitiesHelper.java index 30dad14..38fb7a6 100644 --- a/api/buildcraft/api/core/CapabilitiesHelper.java +++ b/api/buildcraft/api/core/CapabilitiesHelper.java @@ -5,8 +5,7 @@ import java.util.concurrent.Callable; -/** - * Forge has a wonderful system for capabilities, which provides a better way of managing mod compat even if the target +/** Forge has a wonderful system for capabilities, which provides a better way of managing mod compat even if the target * mod isn't loaded. Said system uses ASM data to inject capabilities into every mod, which makes it a matter of * checking a (generic) field at runtime. *

    @@ -18,8 +17,7 @@ *

    * This is NOT designed for mods wishing to add compatibility for buildcraft capability instances: those should still go * via the forge-recommended {@link CapabilityInject} route, or refer to the various fields in buildcraft api classes - * containing the capability instances. - */ + * containing the capability instances. */ public class CapabilitiesHelper { // ################ @@ -28,14 +26,12 @@ public class CapabilitiesHelper { // // ################ - /** - * Registers a given type with {@link #registerCapability(CheckedStorage, Callable)}, but with a + /** Registers a given type with {@link #registerCapability(CheckedStorage, Callable)}, but with a * {@link ThrowingStorage} and a factory that throws an {@link UnsupportedOperationException} instead of creating a * new capability instance. * * @param clazz The type that all instances must derive from. - * @return The registered {@link Capability} - */ + * @return The registered {@link Capability} */ // @Nonnull // public static Capability registerCapability(Class clazz) // { @@ -46,27 +42,23 @@ public class CapabilitiesHelper { // return CapabilityManager.get(new CapabilityToken<>(){}); // } - /** - * Registers a given type with the {@link CapabilityManager}, but also returns the capability instance. + /** Registers a given type with the {@link CapabilityManager}, but also returns the capability instance. * * @param storage The storage for the capability. This must extend {@link CheckedStorage} in order to allow the * internal mechanisms to ensure that nothing went wrong during our meddling into forge. * @param factory The factory for the capability. - * @return The registered {@link Capability} - */ + * @return The registered {@link Capability} */ // @Nonnull // public static Capability registerCapability(CheckedStorage storage, Callable factory) // { // return registerCapInternal(storage, factory); // } - /** - * A type of {@link IStorage} that contains the class that it would store. Used by the internal mechanisms of + /** A type of {@link IStorage} that contains the class that it would store. Used by the internal mechanisms of * {@link CapabilitiesHelper} to ensure that everything registers properly. A default always-throwing implementation * is {@link ThrowingStorage}. * - * @param The type of this storage - */ + * @param The type of this storage */ //// public static abstract class CheckedStorage implements IStorage // public static abstract class CheckedStorage implements ICapabilityProvider, INBTSerializable // { @@ -79,10 +71,8 @@ public class CapabilitiesHelper { // } // } - /** - * A type of {@link CheckedStorage} that throws an {@link UnsupportedOperationException} from both the read and - * write methods. It is designed for {@link Capability Capability's} that must be written and read separately. - */ + /** A type of {@link CheckedStorage} that throws an {@link UnsupportedOperationException} from both the read and + * write methods. It is designed for {@link Capability Capability's} that must be written and read separately. */ // public static final class ThrowingStorage extends CheckedStorage // { // private T capInnerInstance; diff --git a/api/buildcraft/api/mj/MjAPI.java b/api/buildcraft/api/mj/MjAPI.java index 9c79550..0fd7a32 100644 --- a/api/buildcraft/api/mj/MjAPI.java +++ b/api/buildcraft/api/mj/MjAPI.java @@ -16,7 +16,7 @@ import javax.annotation.Nonnull; import java.text.DecimalFormat; -@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = BCCore.MOD_ID) +@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = BCCore.MODID) public class MjAPI { // ################################ diff --git a/api/buildcraft/api/recipes/AssemblyRecipe.java b/api/buildcraft/api/recipes/AssemblyRecipe.java index 2306b13..96057b8 100644 --- a/api/buildcraft/api/recipes/AssemblyRecipe.java +++ b/api/buildcraft/api/recipes/AssemblyRecipe.java @@ -22,7 +22,7 @@ @Deprecated //public abstract class AssemblyRecipe implements Comparable, IForgeRegistryEntry public abstract class AssemblyRecipe implements Comparable, IForgeRegistryEntry, Recipe { - public static final ResourceLocation TYPE_ID = new ResourceLocation(BCSilicon.MOD_ID, "assembly"); + public static final ResourceLocation TYPE_ID = new ResourceLocation(BCSilicon.MODID, "assembly"); public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); From 7885fd37a2c9eee8c6116cef8ac5240980a616ff Mon Sep 17 00:00:00 2001 From: LRW-Calen Date: Sun, 21 Apr 2024 23:35:24 +0800 Subject: [PATCH 06/20] Simple Updates --- .../api/schematics/SchematicBlockFactoryRegistry.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java b/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java index 9b3c90b..cd7d213 100644 --- a/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java +++ b/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java @@ -22,10 +22,10 @@ public synchronized static Set> getFactoriesSynchronize return FACTORIES; } - public static void registerFactory(String name, - int priority, - Predicate predicate, - Supplier supplier) { + public static synchronized void registerFactory(String name, + int priority, + Predicate predicate, + Supplier supplier) { // FACTORIES.add(new SchematicBlockFactory<>( getFactoriesSynchronized().add(new SchematicBlockFactory<>( BuildCraftAPI.nameToResourceLocation(name), From bae7c3c46305d3cf2ba418d1fa37d63f78d3837a Mon Sep 17 00:00:00 2001 From: LRW-Calen Date: Sun, 28 Apr 2024 02:04:27 +0800 Subject: [PATCH 07/20] Cleaned up API module All the classes of API does not import other BC modules now. --- api/buildcraft/api/BCBlocks.java | 76 ++++++++++ api/buildcraft/api/BCItems.java | 81 +++++++++++ api/buildcraft/api/BCModules.java | 19 +-- .../api/blocks/CustomPaintHelper.java | 60 +++++--- .../api/blocks/CustomRotationHelper.java | 13 +- .../api/blocks/ICustomPaintHandler.java | 24 +-- api/buildcraft/api/blocks/ISpring.java | 7 + api/buildcraft/api/blocks/package-info.java | 1 - .../api/boards/RedstoneBoardNBT.java | 3 +- .../api/boards/RedstoneBoardRegistry.java | 1 - api/buildcraft/api/boards/package-info.java | 1 - api/buildcraft/api/core/AreaProviders.java | 24 +++ api/buildcraft/api/core/BCDebugging.java | 24 +-- api/buildcraft/api/core/BuildCraftAPI.java | 13 +- .../api/core/CapabilitiesHelper.java | 95 ++++-------- api/buildcraft/api/core/EnumPipePart.java | 7 +- api/buildcraft/api/core/EnumWireColour.java | 70 +++++++++ api/buildcraft/api/core/IAreaProvider.java | 1 - api/buildcraft/api/core/IEngineType.java | 1 + .../api/core/IFakePlayerProvider.java | 12 +- api/buildcraft/api/core/IFakeWorld.java | 16 ++ api/buildcraft/api/core/IFluidHandlerAdv.java | 14 +- api/buildcraft/api/core/IInvSlot.java | 26 ++++ api/buildcraft/api/core/IStackFilter.java | 4 +- .../api/core/InvalidInputDataException.java | 4 +- api/buildcraft/api/core/JavaTools.java | 39 +++++ api/buildcraft/api/core/SafeTimeTracker.java | 6 +- api/buildcraft/api/core/StackKey.java | 135 +++++++++++++++++ api/buildcraft/api/core/package-info.java | 1 - api/buildcraft/api/crops/CropManager.java | 1 - api/buildcraft/api/crops/ICropHandler.java | 6 +- api/buildcraft/api/crops/package-info.java | 2 - .../api/data/NbtSquishConstants.java | 1 - api/buildcraft/api/enums/EnumEngineType.java | 51 ++----- .../api/enums/EnumExchangePart.java | 18 --- .../api/enums/EnumRedstoneChipset.java | 43 ++---- api/buildcraft/api/enums/EnumSpring.java | 12 +- api/buildcraft/api/enums/package-info.java | 1 - .../api/events/BlockInteractionEvent.java | 1 - .../api/events/RobotPlacementEvent.java | 1 - api/buildcraft/api/events/package-info.java | 1 - api/buildcraft/api/facades/FacadeAPI.java | 11 +- api/buildcraft/api/facades/IFacade.java | 4 + api/buildcraft/api/facades/IFacadeItem.java | 2 + .../api/facades/IFacadeRegistry.java | 2 +- api/buildcraft/api/facades/package-info.java | 3 +- .../api/filler/IFilledTemplate.java | 5 +- api/buildcraft/api/filler/package-info.java | 3 +- api/buildcraft/api/fuels/EnumCoolantType.java | 3 +- api/buildcraft/api/fuels/ICoolant.java | 12 +- api/buildcraft/api/fuels/ICoolantManager.java | 30 ++-- api/buildcraft/api/fuels/IFluidCoolant.java | 19 +-- api/buildcraft/api/fuels/IFuel.java | 25 +--- api/buildcraft/api/fuels/IFuelManager.java | 33 ++--- api/buildcraft/api/fuels/ISolidCoolant.java | 13 +- api/buildcraft/api/fuels/package-info.java | 1 - api/buildcraft/api/gates/package-info.java | 1 - api/buildcraft/api/imc/BcImcMessage.java | 9 +- api/buildcraft/api/items/FluidItemDrops.java | 3 +- api/buildcraft/api/items/IChipset.java | 7 + .../api/items/IItemCustomPipeRender.java | 13 ++ api/buildcraft/api/items/INamedItem.java | 2 +- api/buildcraft/api/items/package-info.java | 1 - api/buildcraft/api/lists/package-info.java | 1 - api/buildcraft/api/mj/MjAPI.java | 61 +------- api/buildcraft/api/mj/MjBattery.java | 3 +- api/buildcraft/api/mj/MjCapabilityHelper.java | 13 +- api/buildcraft/api/net/IMessage.java | 21 +++ api/buildcraft/api/net/IMessageHandler.java | 7 + api/buildcraft/api/power/package-info.java | 1 - .../api/properties/BuildCraftProperties.java | 46 ++---- .../api/recipes/AssemblyRecipe.java | 137 ------------------ .../api/recipes/AssemblyRecipeBasic.java | 102 ------------- ...eType.java => EnumAssemblyRecipeType.java} | 3 +- .../api/recipes/IAssemblyRecipe.java | 77 ++++++++++ .../api/recipes/IRefineryRecipeManager.java | 32 ++-- .../api/recipes/IngredientStack.java | 3 +- .../api/recipes/StackDefinition.java | 1 - api/buildcraft/api/recipes/package-info.java | 1 - .../api/registry/IScriptableRegistry.java | 6 +- api/buildcraft/api/robots/AIRobot.java | 24 +-- api/buildcraft/api/robots/DockingStation.java | 23 +-- .../api/robots/EntityRobotBase.java | 7 +- api/buildcraft/api/robots/ResourceId.java | 6 +- .../api/robots/ResourceIdBlock.java | 2 +- api/buildcraft/api/robots/RobotManager.java | 3 +- api/buildcraft/api/robots/package-info.java | 1 - .../api/schematics/ISchematicBlock.java | 6 +- .../SchematicBlockFactoryRegistry.java | 2 +- .../SchematicEntityFactoryRegistry.java | 21 +-- api/buildcraft/api/statements/IGuiSlot.java | 20 +-- api/buildcraft/api/statements/IStatement.java | 3 +- .../api/statements/ITriggerProvider.java | 2 +- .../api/statements/StatementManager.java | 4 - .../StatementParameterItemStack.java | 25 ++-- .../api/statements/StatementSlot.java | 1 - .../api/statements/package-info.java | 1 - .../api/tiles/IBCTileMenuProvider.java | 9 ++ api/buildcraft/api/tiles/IDebuggable.java | 15 +- api/buildcraft/api/tiles/ITickable.java | 42 ++++++ .../api/tiles/ITileAreaProvider.java | 1 - api/buildcraft/api/tiles/TilesAPI.java | 12 +- api/buildcraft/api/tiles/package-info.java | 1 - api/buildcraft/api/tools/package-info.java | 1 - .../api/transport/EnumWirePart.java | 17 +-- .../api/transport/IItemPluggable.java | 3 +- .../api/transport/IStripesHandlerBlock.java | 2 +- .../api/transport/IStripesRegistry.java | 2 +- api/buildcraft/api/transport/WireNode.java | 3 +- .../api/transport/package-info.java | 1 - .../transport/pipe/ICustomPipeConnection.java | 2 +- .../api/transport/pipe/IFlowFluid.java | 59 ++++---- .../api/transport/pipe/IItemPipe.java | 1 - .../pipe/IPipeBehaviourRenderer.java | 1 - .../transport/pipe/IPipeExtensionManager.java | 4 +- .../api/transport/pipe/IPipeHolder.java | 73 +++------- .../api/transport/pipe/IPipeRegistry.java | 21 +-- .../api/transport/pipe/PipeApi.java | 17 +-- .../api/transport/pipe/PipeApiClient.java | 6 +- .../api/transport/pipe/PipeBehaviour.java | 10 +- .../api/transport/pipe/PipeConnectionAPI.java | 14 +- .../api/transport/pipe/PipeDefinition.java | 11 +- .../api/transport/pipe/PipeEventFluid.java | 3 +- .../api/transport/pipe/PipeEventItem.java | 12 +- .../api/transport/pipe/PipeFaceTex.java | 8 +- .../api/transport/pipe/PipeFlow.java | 28 +--- .../pluggable/IPlugDynamicRenderer.java | 3 +- .../transport/pluggable/PipePluggable.java | 78 ++++------ .../pluggable/PluggableDefinition.java | 12 +- 129 files changed, 1108 insertions(+), 1148 deletions(-) create mode 100644 api/buildcraft/api/BCBlocks.java create mode 100644 api/buildcraft/api/BCItems.java create mode 100644 api/buildcraft/api/blocks/ISpring.java create mode 100644 api/buildcraft/api/core/AreaProviders.java create mode 100644 api/buildcraft/api/core/EnumWireColour.java create mode 100644 api/buildcraft/api/core/IFakeWorld.java create mode 100644 api/buildcraft/api/core/IInvSlot.java create mode 100644 api/buildcraft/api/core/JavaTools.java create mode 100644 api/buildcraft/api/core/StackKey.java delete mode 100644 api/buildcraft/api/enums/EnumExchangePart.java create mode 100644 api/buildcraft/api/items/IChipset.java create mode 100644 api/buildcraft/api/items/IItemCustomPipeRender.java create mode 100644 api/buildcraft/api/net/IMessage.java create mode 100644 api/buildcraft/api/net/IMessageHandler.java delete mode 100644 api/buildcraft/api/recipes/AssemblyRecipe.java delete mode 100644 api/buildcraft/api/recipes/AssemblyRecipeBasic.java rename api/buildcraft/api/recipes/{AssemblyRecipeType.java => EnumAssemblyRecipeType.java} (58%) create mode 100644 api/buildcraft/api/recipes/IAssemblyRecipe.java create mode 100644 api/buildcraft/api/tiles/IBCTileMenuProvider.java create mode 100644 api/buildcraft/api/tiles/ITickable.java diff --git a/api/buildcraft/api/BCBlocks.java b/api/buildcraft/api/BCBlocks.java new file mode 100644 index 0000000..f248fab --- /dev/null +++ b/api/buildcraft/api/BCBlocks.java @@ -0,0 +1,76 @@ +package buildcraft.api; + +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_WATER = null; + public static final Block SPRING_OIL = null; + public static final Block DECORATED_DESTROY = null; + public static final Block DECORATED_BLUEPRINT = null; + public static final Block DECORATED_TEMPLATE = null; + public static final Block DECORATED_PAPER = null; + public static final Block DECORATED_LEATHER = null; + public static final Block DECORATED_LASER_BACK = null; + public static final Block ENGINE_WOOD = null; + public static final Block ENGINE_STONE = null; + public static final Block ENGINE_IRON = null; + public static final Block ENGINE_CREATIVE = null; + public static final Block MARKER_VOLUME = null; + public static final Block MARKER_PATH = null; + } + + @ObjectHolder("buildcraftbuilders") + public static class Builders { + public static final Block ARCHITECT = null; + public static final Block BUILDER = null; + public static final Block FILLER = null; + public static final Block LIBRARY = null; + public static final Block REPLACER = null; + public static final Block QUARRY = null; + public static final Block FRAME = null; + } + + @ObjectHolder("buildcraftenergy") + public static class Energy { + // Fluid blocks can be accessed ~somewhere else~ + } + + @ObjectHolder("buildcraftfactory") + public static class Factory { + public static final Block AUTOWORKBENCH_ITEM = null; + public static final Block MINING_WELL = null; + public static final Block PUMP = null; + public static final Block TUBE = null; + public static final Block FLOOD_GATE = null; + public static final Block TANK = null; + public static final Block CHUTE = null; + public static final Block WATER_GEL = null; + public static final Block DISTILLER = null; + public static final Block HEAT_EXCHANGE = null; + } + + @ObjectHolder("buildcrafttransport") + public static class Transport { + public static final Block FILTERED_BUFFER = null; + public static final Block PIPE_HOLDER = null; + } + + @ObjectHolder("buildcraftsilicon") + public static class Silicon { + public static final Block LASER = null; + public static final Block ASSEMBLY_TABLE = null; + public static final Block ADVANCED_CRAFTING_TABLE = null; + public static final Block INTEGRATION_TABLE = null; + public static final Block CHARGING_TABLE = null; + public static final Block PROGRAMMING_TABLE = null; + } + + @ObjectHolder("buildcraftrobotics") + public static class Robotics { + + } +} diff --git a/api/buildcraft/api/BCItems.java b/api/buildcraft/api/BCItems.java new file mode 100644 index 0000000..fcddd54 --- /dev/null +++ b/api/buildcraft/api/BCItems.java @@ -0,0 +1,81 @@ +package buildcraft.api; + +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 { + public static final Item GUIDE = null; + public static final Item GUIDE_NOTE = null; + public static final Item DEBUGGER = null; + } + + @ObjectHolder("buildcraftcore") + public static class Core { + public static final Item GEAR_WOOD = null; + public static final Item GEAR_STONE = null; + public static final Item GEAR_IRON = null; + public static final Item GEAR_GOLD = null; + public static final Item GEAR_DIAMOND = null; + public static final Item WRENCH = null; + public static final Item PAINTBRUSH_CLEAN = null; + public static final Item LIST = null; + public static final Item MAP_LOCATION = null; + public static final Item MARKER_CONNECTOR = null; + public static final Item VOLUME_BOX = null; + public static final Item GOGGLES = null; + + /** It is recommended that you refer to {@link FluidItemDrops#item} when creating fluid drops rather than + * this. */ + public static final Item FRAGILE_FLUID_SHARD = null; + } + + @ObjectHolder("buildcraftbuilders") + public static class Builders { + + } + + @ObjectHolder("buildcraftenergy") + public static class Energy { + public static final Item GLOB_OIL = null; + } + + @ObjectHolder("buildcraftfactory") + public static class Factory { + public static final Item PLASTIC_SHEET = null; + public static final Item WATER_GEL_SPAWN = null; + public static final Item GEL = null; + } + + @ObjectHolder("buildcrafttransport") + public static class Transport { + public static final Item PLUG_BLOCKER = null; + public static final Item PLUG_POWER_ADAPTOR = null; + + public static final Item PIPE_STRUCTURE_COBBLESTONE_COLORLESS = null; + public static final Item PIPE_ITEMS_WOOD_COLORLESS = null; + public static final Item PIPE_ITEMS_EMZULI_COLORLESS = null; + public static final Item PIPE_ITEMS_DIAMOND_WOOD_COLORLESS = null; + public static final Item PIPE_FLUIDS_WOOD_COLORLESS = null; + public static final Item PIPE_FLUIDS_DIAMOND_WOOD_COLORLESS = null; + } + + @ObjectHolder("buildcraftsilicon") + public static class Silicon { + public static final Item CHIPSET_REDSTONE = null; + public static final Item CHIPSET_IRON = null; + public static final Item CHIPSET_GOLD = null; + public static final Item CHIPSET_QUARTZ = null; + public static final Item CHIPSET_DIAMOND = null; + + public static final Item PLUG_PULSAR = null; + } + + @ObjectHolder("buildcraftrobotics") + public static class Robotics { + + } +} diff --git a/api/buildcraft/api/BCModules.java b/api/buildcraft/api/BCModules.java index 94b3804..a5c4bea 100644 --- a/api/buildcraft/api/BCModules.java +++ b/api/buildcraft/api/BCModules.java @@ -3,6 +3,8 @@ 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; @@ -33,7 +35,7 @@ public enum BCModules implements IBuildCraftMod { 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; @@ -44,27 +46,22 @@ private static void checkLoadStatus() { load0(); } - /** - * Performs the actual loading of {@link #checkLoadStatus()}, except this is thread safe. - */ + /** Performs the actual loading of {@link #checkLoadStatus()}, except this is thread safe. */ private static synchronized void load0() { if (hasChecked) { return; } - // Calen: loading events order is changed from 1.12.2 to 1.18.2... // 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!"); -// } + if (ModLoadingContext.get().getActiveContainer().getCurrentState().ordinal() < ModLoadingStage.CONSTRUCT.ordinal()) { + throw new RuntimeException("You can only use BCModules.isLoaded from pre-init onwards!"); + } List found = new ArrayList<>(), missing = new ArrayList<>(); for (BCModules module : VALUES) { module.loaded = ModList.get().isLoaded(module.modId); if (module.loaded) { found.add(module); - } - else { + } else { missing.add(module); } } diff --git a/api/buildcraft/api/blocks/CustomPaintHelper.java b/api/buildcraft/api/blocks/CustomPaintHelper.java index 9e18612..ac0dfb2 100644 --- a/api/buildcraft/api/blocks/CustomPaintHelper.java +++ b/api/buildcraft/api/blocks/CustomPaintHelper.java @@ -2,7 +2,6 @@ import buildcraft.api.core.BCDebugging; import buildcraft.api.core.BCLog; -import buildcraft.lib.misc.BlockUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import net.minecraft.core.BlockPos; @@ -12,6 +11,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.phys.Vec3; import net.minecraftforge.registries.ForgeRegistries; @@ -19,10 +19,8 @@ import java.util.List; import java.util.Map; -/** - * Provides a simple way to paint a single core, iterating through all {@link ICustomPaintHandler}'s that are - * registered for the core. - */ +/** Provides a simple way to paint a single block, iterating through all {@link ICustomPaintHandler}'s that are + * registered for the block. */ public enum CustomPaintHelper { INSTANCE; @@ -33,10 +31,8 @@ public enum CustomPaintHelper { private final Map> handlers = Maps.newIdentityHashMap(); private final List allHandlers = Lists.newArrayList(); - /** - * Registers a handler that will be called LAST for ALL blocks, if all other paint handlers have returned PASS or - * none are registered for that core. - */ + /** Registers a handler that will be called LAST for ALL blocks, if all other paint handlers have returned PASS or + * none are registered for that block. */ public void registerHandlerForAll(ICustomPaintHandler handler) { if (DEBUG) { BCLog.logger.info("[api.painting] Adding a paint handler for ALL blocks (" + handler.getClass() + ")"); @@ -44,9 +40,7 @@ public void registerHandlerForAll(ICustomPaintHandler handler) { allHandlers.add(handler); } - /** - * Register's a paint handler for every class of a given core. - */ + /** Register's a paint handler for every class of a given block. */ public void registerHandlerForAll(Class blockClass, ICustomPaintHandler handler) { // for (Block block : Block.REGISTRY) for (Block block : ForgeRegistries.BLOCKS.getValues()) { @@ -65,8 +59,7 @@ public void registerHandler(Block block, ICustomPaintHandler handler) { if (DEBUG) { BCLog.logger.info("[api.painting] Setting a paint handler for block " + block.getRegistryName() + "(" + handler.getClass() + ")"); } - } - else if (DEBUG) { + } else if (DEBUG) { BCLog.logger.info("[api.painting] Adding another paint handler for block " + block.getRegistryName() + "(" + handler.getClass() + ")"); } } @@ -77,16 +70,13 @@ private boolean registerHandlerInternal(Block block, ICustomPaintHandler handler forBlock.add(handler); handlers.put(block, forBlock); return true; - } - else { + } else { handlers.get(block).add(handler); return false; } } - /** - * Attempts to paint a core at the given position. Basically iterates through all registered paint handlers. - */ + /** Attempts to paint a block at the given position. Basically iterates through all registered paint handlers. */ public InteractionResult attemptPaintBlock(Level world, BlockPos pos, BlockState state, Vec3 hitPos, @Nullable Direction hitSide, @Nullable DyeColor paint) { Block block = state.getBlock(); if (block instanceof ICustomPaintHandler) { @@ -115,13 +105,37 @@ private InteractionResult defaultAttemptPaint(Level world, BlockPos pos, BlockSt if (paint == null) { return InteractionResult.FAIL; } - Block b = state.getBlock(); +// Block b = state.getBlock(); // if (b.recolorBlock(world, pos, hitSide, paint)) - if (BlockUtil.recolorBlock(world, pos, hitSide, paint)) { + if (recolorBlock(world, pos, hitSide, paint)) { return InteractionResult.SUCCESS; - } - else { + } else { return InteractionResult.FAIL; } } + + /** + * From 1.12.2 Block + * Common way to recolor a block with an external tool + * + * @param world The world + * @param pos Block position in world + * @param side The side hit with the coloring tool + * @param color The color to change to + * @return If the recoloring was successful + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + public static boolean recolorBlock(Level world, BlockPos pos, Direction side, DyeColor color) { + BlockState state = world.getBlockState(pos); + for (Property prop : state.getProperties()) { + if (prop.getName().equals("color") && prop.getValueClass() == DyeColor.class) { + DyeColor current = (DyeColor) state.getValue(prop); + if (current != color && prop.getPossibleValues().contains(color)) { + world.setBlock(pos, state.setValue(prop, color), Block.UPDATE_ALL); + return true; + } + } + } + return false; + } } diff --git a/api/buildcraft/api/blocks/CustomRotationHelper.java b/api/buildcraft/api/blocks/CustomRotationHelper.java index 2000883..c2e5883 100644 --- a/api/buildcraft/api/blocks/CustomRotationHelper.java +++ b/api/buildcraft/api/blocks/CustomRotationHelper.java @@ -26,11 +26,10 @@ public enum CustomRotationHelper { public void registerHandlerForAll(Class blockClass, ICustomRotationHandler handler) { for (Block block : ForgeRegistries.BLOCKS) { - Class foundClass = block.getClass(); if (blockClass.isAssignableFrom(foundClass)) { if (DEBUG) { - BCLog.logger.info("[api.rotation] Found an assignable core " + block.getRegistryName() + " (" + foundClass + ") for " + blockClass); + BCLog.logger.info("[api.rotation] Found an assignable block " + block.getRegistryName() + " (" + foundClass + ") for " + blockClass); } registerHandlerInternal(block, handler); } @@ -40,11 +39,10 @@ public void registerHandlerForAll(Class blockClass, ICustomRota public void registerHandler(Block block, ICustomRotationHandler handler) { if (registerHandlerInternal(block, handler)) { if (DEBUG) { - BCLog.logger.info("[api.rotation] Setting a rotation handler for core " + block.getRegistryName()); + BCLog.logger.info("[api.rotation] Setting a rotation handler for block " + block.getRegistryName()); } - } - else if (DEBUG) { - BCLog.logger.info("[api.rotation] Adding another rotation handler for core " + block.getRegistryName()); + } else if (DEBUG) { + BCLog.logger.info("[api.rotation] Adding another rotation handler for block " + block.getRegistryName()); } } @@ -54,8 +52,7 @@ private boolean registerHandlerInternal(Block block, ICustomRotationHandler hand forBlock.add(handler); handlers.put(block, forBlock); return true; - } - else { + } else { handlers.get(block).add(handler); return false; } diff --git a/api/buildcraft/api/blocks/ICustomPaintHandler.java b/api/buildcraft/api/blocks/ICustomPaintHandler.java index 4e9dc2e..e717ccc 100644 --- a/api/buildcraft/api/blocks/ICustomPaintHandler.java +++ b/api/buildcraft/api/blocks/ICustomPaintHandler.java @@ -10,22 +10,22 @@ import javax.annotation.Nullable; -/** Provides a way to paint blocks from any position. You can either implement this on a core, or register an instance - * for a core with {@link CustomPaintHelper} */ +/** Provides a way to paint blocks from any position. You can either implement this on a block, or register an instance + * for a block with {@link CustomPaintHelper} */ public interface ICustomPaintHandler { - /** Attempts to paint the given core. This can also only paint a specific part of the core (as the hit position is + /** Attempts to paint the given block. This can also only paint a specific part of the block (as the hit position is * given). * - * @param world The world that the core is contained within. - * @param pos The position of the core. - * @param state The current state of the core. + * @param world The world that the block is contained within. + * @param pos The position of the block. + * @param state The current state of the block. * @param hitPos The absolute hit position of the paintbrush, relative the world's origin. - * @param hitSide The side of the core that was hit. + * @param hitSide The side of the block that was hit. * @param paintColour The paint colour to attempt to paint with, null if the paint should be cleared (so if this was - * a stained glass core, and null was passed, this would set it to a normal, clear, non-stained glass - * core. - * @return The result of attempting to paint. SUCCESS means that you changed the core from before to a new value, - * FAIL means you COULD have handled the core, but it was already painted to that colour, or PASS if you - * have no idea how to handle the core in question. */ + * a stained glass block, and null was passed, this would set it to a normal, clear, non-stained glass + * block. + * @return The result of attempting to paint. SUCCESS means that you changed the block from before to a new value, + * FAIL means you COULD have handled the block, but it was already painted to that colour, or PASS if you + * have no idea how to handle the block in question. */ InteractionResult attemptPaint(Level world, BlockPos pos, BlockState state, Vec3 hitPos, @Nullable Direction hitSide, @Nullable DyeColor paintColour); } diff --git a/api/buildcraft/api/blocks/ISpring.java b/api/buildcraft/api/blocks/ISpring.java new file mode 100644 index 0000000..27903b6 --- /dev/null +++ b/api/buildcraft/api/blocks/ISpring.java @@ -0,0 +1,7 @@ +package buildcraft.api.blocks; + +import buildcraft.api.enums.EnumSpring; + +public interface ISpring { + EnumSpring getType(); +} diff --git a/api/buildcraft/api/blocks/package-info.java b/api/buildcraft/api/blocks/package-info.java index 6096d75..a820019 100644 --- a/api/buildcraft/api/blocks/package-info.java +++ b/api/buildcraft/api/blocks/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_blocks") package buildcraft.api.blocks; - diff --git a/api/buildcraft/api/boards/RedstoneBoardNBT.java b/api/buildcraft/api/boards/RedstoneBoardNBT.java index cddc0fc..1508afa 100755 --- a/api/buildcraft/api/boards/RedstoneBoardNBT.java +++ b/api/buildcraft/api/boards/RedstoneBoardNBT.java @@ -33,8 +33,7 @@ public void createBoard(CompoundTag nbt) { public int getParameterNumber(CompoundTag nbt) { if (!nbt.contains("parameters")) { return 0; - } - else { + } else { return nbt.getList("parameters", Tag.TAG_COMPOUND).size(); } } diff --git a/api/buildcraft/api/boards/RedstoneBoardRegistry.java b/api/buildcraft/api/boards/RedstoneBoardRegistry.java index 8dbd17b..c3b6157 100755 --- a/api/buildcraft/api/boards/RedstoneBoardRegistry.java +++ b/api/buildcraft/api/boards/RedstoneBoardRegistry.java @@ -4,7 +4,6 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.boards; - import net.minecraft.nbt.CompoundTag; import java.util.Collection; diff --git a/api/buildcraft/api/boards/package-info.java b/api/buildcraft/api/boards/package-info.java index 8aa09ed..8ee0580 100644 --- a/api/buildcraft/api/boards/package-info.java +++ b/api/buildcraft/api/boards/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_boards") package buildcraft.api.boards; - diff --git a/api/buildcraft/api/core/AreaProviders.java b/api/buildcraft/api/core/AreaProviders.java new file mode 100644 index 0000000..e802c4e --- /dev/null +++ b/api/buildcraft/api/core/AreaProviders.java @@ -0,0 +1,24 @@ +package buildcraft.api.core; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; + +import java.util.ArrayList; +import java.util.List; + +public class AreaProviders { + public static final List providers = new ArrayList<>(); + + public interface IAreaProviderGetter { + /** @return All of the {@link IAreaProvider}'s that contain the specified block psoition. */ + List getAreaProviders(Level world, BlockPos at); + } + + public static List getAreaProviders(Level world, BlockPos at) { + List list = new ArrayList<>(); + for (IAreaProviderGetter getter : providers) { + list.addAll(getter.getAreaProviders(world, at)); + } + return list; + } +} diff --git a/api/buildcraft/api/core/BCDebugging.java b/api/buildcraft/api/core/BCDebugging.java index ef203ed..e89af50 100644 --- a/api/buildcraft/api/core/BCDebugging.java +++ b/api/buildcraft/api/core/BCDebugging.java @@ -45,8 +45,7 @@ enum DebugLevel { Method getBlockEntity = Level.class.getDeclaredMethod("getBlockEntity", BlockPos.class); BCLog.logger.info("[debugger] Method found: Level.getBlockEntity = " + getBlockEntity); isDev = true; - } - catch (Throwable ignored) { + } catch (Throwable ignored) { // If it didn't find it then we aren't in a dev environment isDev = false; BCLog.logger.info("[debugger] Not a dev environment!"); @@ -58,26 +57,21 @@ enum DebugLevel { else if ("disable".equals(value)) { // let people disable the messages if they are in a dev environment but don't want messages. DEBUG_STATUS = DebugStatus.NONE; - } - else if ("log".equals(value)) { + } else if ("log".equals(value)) { // Some debugging options are more than just logging, so we will differentiate between them DEBUG_STATUS = DebugStatus.LOGGING_ONLY; - } - else if (isDev) { + } else if (isDev) { DEBUG_STATUS = DebugStatus.ENABLE; - } - else { + } else { // Most likely a built jar - don't spam people with info they probably don't need DEBUG_STATUS = DebugStatus.NONE; } if (DEBUG_STATUS == DebugStatus.ALL) { BCLog.logger.info("[debugger] Debugging automatically enabled for ALL of buildcraft. Prepare for log spam."); - } - else if (DEBUG_STATUS == DebugStatus.LOGGING_ONLY) { + } else if (DEBUG_STATUS == DebugStatus.LOGGING_ONLY) { BCLog.logger.info("[debugger] Debugging automatically enabled for some non-spammy parts of buildcraft."); - } - else if (DEBUG_STATUS == DebugStatus.ENABLE) { + } else if (DEBUG_STATUS == DebugStatus.ENABLE) { BCLog.logger.info("[debugger] Debugging not automatically enabled for all of buildcraft. Logging all possible debug options."); BCLog.logger.info(" To enable it for only logging messages add \"-Dbuildcraft.debug=log\" to your launch VM arguments"); BCLog.logger.info(" To enable it for ALL debugging \"-Dbuildcraft.debug=all\" to your launch VM arguments"); @@ -102,8 +96,7 @@ private static boolean shouldDebug(String option, DebugLevel type) { if ("false".equals(actual)) { BCLog.logger.info("[debugger] Debugging manually disabled for \"" + option + "\" (" + type + ")."); return false; - } - else if ("true".equals(actual)) { + } else if ("true".equals(actual)) { BCLog.logger.info("[debugger] Debugging enabled for \"" + option + "\" (" + type + ")."); return true; } @@ -114,8 +107,7 @@ else if ("true".equals(actual)) { if ("complex".equals(actual) || type.name.equals(actual)) { BCLog.logger.info("[debugger] Debugging enabled for \"" + option + "\" (" + type + ")."); return true; - } - else if (DEBUG_STATUS != DebugStatus.NONE) { + } else if (DEBUG_STATUS != DebugStatus.NONE) { StringBuilder log = new StringBuilder(); log.append("[debugger] To enable debugging for "); log.append(option); diff --git a/api/buildcraft/api/core/BuildCraftAPI.java b/api/buildcraft/api/core/BuildCraftAPI.java index af9059e..3081f26 100644 --- a/api/buildcraft/api/core/BuildCraftAPI.java +++ b/api/buildcraft/api/core/BuildCraftAPI.java @@ -1,9 +1,7 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - *

    - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. - */ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.core; import com.google.common.collect.Maps; @@ -54,9 +52,8 @@ public static boolean isSoftBlock(Level world, BlockPos pos) { public static ResourceLocation nameToResourceLocation(String name) { if (name.indexOf(':') > 0) return new ResourceLocation(name); -// ModContainer modContainer = ModLoader.get().activeModContainer(); +// ModContainer modContainer = Loader.instance().activeModContainer(); ModContainer modContainer = ModLoadingContext.get().getActiveContainer(); -// ModContainer modContainer = ModList.get().getModContainerById(BuildCraft.MOD_ID); if (modContainer == null) { throw new IllegalStateException("Illegal recipe name " + name + ". Provide domain id to register it correctly."); } diff --git a/api/buildcraft/api/core/CapabilitiesHelper.java b/api/buildcraft/api/core/CapabilitiesHelper.java index 38fb7a6..e947e6f 100644 --- a/api/buildcraft/api/core/CapabilitiesHelper.java +++ b/api/buildcraft/api/core/CapabilitiesHelper.java @@ -33,13 +33,10 @@ public class CapabilitiesHelper { * @param clazz The type that all instances must derive from. * @return The registered {@link Capability} */ // @Nonnull -// public static Capability registerCapability(Class clazz) -// { -//// return registerCapability(new ThrowingStorage<>(clazz), () -> -//// { -//// throw new UnsupportedOperationException("You must create your own instances!"); -//// }); -// return CapabilityManager.get(new CapabilityToken<>(){}); +// public static Capability registerCapability(Class clazz) { +// return registerCapability(new ThrowingStorage<>(clazz), () -> { +// throw new UnsupportedOperationException("You must create your own instances!"); +// }); // } /** Registers a given type with the {@link CapabilityManager}, but also returns the capability instance. @@ -49,8 +46,7 @@ public class CapabilitiesHelper { * @param factory The factory for the capability. * @return The registered {@link Capability} */ // @Nonnull -// public static Capability registerCapability(CheckedStorage storage, Callable factory) -// { +// public static Capability registerCapability(CheckedStorage storage, Callable factory) { // return registerCapInternal(storage, factory); // } @@ -59,50 +55,32 @@ public class CapabilitiesHelper { * is {@link ThrowingStorage}. * * @param The type of this storage */ -//// public static abstract class CheckedStorage implements IStorage -// public static abstract class CheckedStorage implements ICapabilityProvider, INBTSerializable -// { +// public static abstract class CheckedStorage implements IStorage { // // public final Class clazz; // -// public CheckedStorage(Class clazz) -// { +// public CheckedStorage(Class clazz) { // this.clazz = clazz; // } // } /** A type of {@link CheckedStorage} that throws an {@link UnsupportedOperationException} from both the read and * write methods. It is designed for {@link Capability Capability's} that must be written and read separately. */ -// public static final class ThrowingStorage extends CheckedStorage -// { -// private T capInnerInstance; +// public static final class ThrowingStorage extends CheckedStorage { // -// public ThrowingStorage(Class clazz) -// { +// public ThrowingStorage(Class clazz) { // super(clazz); -// capInnerInstance = new T(); // } // // @Override -//// public Tag writeNBT(Capability capability, T instance, Direction side) -// public Tag serializeNBT() -// { +// public NBTBase writeNBT(Capability capability, T instance, EnumFacing side) { // throw new UnsupportedOperationException("You must create your own instances!"); // } // // @Override -//// public void readNBT(Capability capability, T instance, Direction side, Tag nbt) -// public void deserializeNBT(Tag nbt) -// { +// public void readNBT(Capability capability, T instance, EnumFacing side, NBTBase nbt) { // throw new UnsupportedOperationException("You must create your own instances!"); // } -// -// @NotNull -// @Override -// public LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) -// { -// return null; -// } // } // ################ @@ -112,41 +90,33 @@ public class CapabilitiesHelper { // ################ // private static final IdentityHashMap __FIELD_CAP_MANAGER_PROVIDERS; -// -// static -// { -// try -// { + +// static { +// try { // Field fld = CapabilityManager.class.getDeclaredField("providers"); // fld.setAccessible(true); // Object obj = fld.get(CapabilityManager.INSTANCE); // __FIELD_CAP_MANAGER_PROVIDERS = (IdentityHashMap) obj; -// if (__FIELD_CAP_MANAGER_PROVIDERS == null) -// { +// if (__FIELD_CAP_MANAGER_PROVIDERS == null) { // throw new Error("Couldn't find providers!"); // } -// } -// catch (ReflectiveOperationException | ClassCastException e) -// { +// } catch (ReflectiveOperationException | ClassCastException e) { // throw new Error(e); // } // } // @Nonnull -// private static Capability registerCapInternal(CheckedStorage storage, Callable factory) -// { +// private static Capability registerCapInternal(CheckedStorage storage, Callable factory) { // Class clazz = storage.clazz; // // CapabilityManager.INSTANCE.register(clazz, storage, factory); // // String fullName = clazz.getName().intern(); // Object obj = __FIELD_CAP_MANAGER_PROVIDERS.get(fullName); -// if (obj == null) -// { +// if (obj == null) { // throw new IllegalStateException("Apparently we didn't register the capability? How?"); // } -// if (!(obj instanceof Capability)) -// { +// if (!(obj instanceof Capability)) { // throw new Error("We must have the wrong map! providers.get(key) returned " + obj.getClass() // + " rather than " + Capability.class); // } @@ -155,46 +125,37 @@ public class CapabilitiesHelper { // // compare the given class with the VoidStorage class, as // // Capability doesn't have a way of doing that directly. // IStorage cStorage = cap.getStorage(); -// if (!(cStorage instanceof CheckedStorage)) -// { +// if (!(cStorage instanceof CheckedStorage)) { // throw new IllegalStateException( // "Returned capability storage has a different storage class than expected! " + cStorage.getClass()); // } // CheckedStorage vStorage = (CheckedStorage) cStorage; -// if (vStorage.clazz != clazz) -// { +// if (vStorage.clazz != clazz) { // throw new IllegalStateException( // "Returned capability storage has a different class than expected! " + vStorage.clazz + " vs " + clazz); // } // return (Capability) cap; // } -// /** -// * Prefer {@link #registerCapability(Class)} or other methods over this one: this will be removed at some point in -// * the future. Most likely before beta. -// */ + /** Prefer {@link #registerCapability(Class)} or other methods over this one: this will be removed at some point in + * the future. Most likely before beta. */ // @Nonnull // @Deprecated -// public static Capability ensureRegistration(Capability cap, Class clazz) -// { -// if (cap == null) -// { +// public static Capability ensureRegistration(Capability cap, Class clazz) { +// if (cap == null) { // throw new Error("Capability registration failed for " + clazz); // } // return cap; // } -// public static class VoidStorage implements Capability.IStorage -// { +// public static class VoidStorage implements Capability.IStorage { // @Override -// public Tag writeNBT(Capability capability, T instance, Direction side) -// { +// public NBTBase writeNBT(Capability capability, T instance, EnumFacing side) { // throw new IllegalStateException("You must create your own instances!"); // } // // @Override -// public void readNBT(Capability capability, T instance, Direction side, Tag nbt) -// { +// public void readNBT(Capability capability, T instance, EnumFacing side, NBTBase nbt) { // throw new IllegalStateException("You must create your own instances!"); // } // } diff --git a/api/buildcraft/api/core/EnumPipePart.java b/api/buildcraft/api/core/EnumPipePart.java index e5bf41f..d9c3cf2 100644 --- a/api/buildcraft/api/core/EnumPipePart.java +++ b/api/buildcraft/api/core/EnumPipePart.java @@ -36,10 +36,8 @@ public enum EnumPipePart implements StringRepresentable { if (part.face != null) facingMap.put(part.face, part); } FACES = fromFacingArray(Direction.values()); - // 1.18.2 HORIZONTALS -> private BY_2D_DATA // HORIZONTALS = fromFacingArray(Direction.HORIZONTALS); - HORIZONTALS = fromFacingArray(Direction.from2DDataValue(0), Direction.from2DDataValue(1), Direction.from2DDataValue(2), Direction.from2DDataValue(3)); - + HORIZONTALS = fromFacingArray(Direction.BY_2D_DATA); } private static EnumPipePart[] fromFacingArray(Direction... faces) { @@ -120,8 +118,7 @@ public static EnumPipePart readFromNBT(Tag base) { StringTag nbtString = (StringTag) base; String string = nbtString.getAsString(); return nameMap.getOrDefault(string, CENTER); - } - else { + } else { byte ord = ((NumericTag) base).getAsByte(); if (ord < 0 || ord > 6) { return CENTER; diff --git a/api/buildcraft/api/core/EnumWireColour.java b/api/buildcraft/api/core/EnumWireColour.java new file mode 100644 index 0000000..95249b9 --- /dev/null +++ b/api/buildcraft/api/core/EnumWireColour.java @@ -0,0 +1,70 @@ +package buildcraft.api.core; + +import net.minecraft.world.item.DyeColor; + +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.Set; + +/** A subset of colours from {@link DyeColor} that are suitable for use in LED's or wires (or equivalent). In other + * words they must all be uniquely identifiable from both their lit and dark colours, and not look similar to other + * colours. */ +@Deprecated(forRemoval = true) +public enum EnumWireColour { + // We disallow all variants of grey and black, as they don't make much sense relative to LED's. + // In theory we could keep black OR dark gey LED's (as they are very distant) but it's simpler not to. + WHITE(DyeColor.WHITE, DyeColor.LIGHT_GRAY, DyeColor.GRAY, DyeColor.BLACK), + ORANGE(DyeColor.ORANGE), + // MAGENTA -> PINK + LIGHT_BLUE(DyeColor.LIGHT_BLUE, DyeColor.CYAN), + YELLOW(DyeColor.YELLOW), + LIME(DyeColor.LIME), + PINK(DyeColor.PINK, DyeColor.MAGENTA), + // GRAY -> WHITE + // SILVER (LIGHT_GRAY) -> WHITE + // CYAN -> LIGHT_BLUE + PURPLE(DyeColor.PURPLE), + BLUE(DyeColor.BLUE), + BROWN(DyeColor.BROWN), + GREEN(DyeColor.GREEN), + RED(DyeColor.RED), + // BLACK -> WHITE + ; + + private static final EnumMap DYE_TO_WIRE; + + static { + DYE_TO_WIRE = new EnumMap<>(DyeColor.class); + for (EnumWireColour wire : values()) { + for (DyeColor dye : wire.similarBasedColours) { + EnumWireColour prev = DYE_TO_WIRE.put(dye, wire); + if (prev != null) { + throw new Error(wire + " attempted to override " + prev + " for the dye " + dye + "!"); + } + } + } + + for (DyeColor dye : DyeColor.values()) { + EnumWireColour wire = DYE_TO_WIRE.get(dye); + if (wire == null) { + throw new Error(dye + " isn't mapped to a wire colour!"); + } + } + } + + /** The primary minecraft colour that this is based on. */ + public final DyeColor primaryIdenticalColour; + + /** A set of similar minecraft colours that this single colour is based on. Always includes + * {@link #primaryIdenticalColour}. */ + public final Set similarBasedColours; + + private EnumWireColour(DyeColor primary, DyeColor... secondary) { + this.primaryIdenticalColour = primary; + this.similarBasedColours = EnumSet.of(primary, secondary); + } + + public static EnumWireColour convertToWire(DyeColor dye) { + return DYE_TO_WIRE.get(dye); + } +} diff --git a/api/buildcraft/api/core/IAreaProvider.java b/api/buildcraft/api/core/IAreaProvider.java index 3cb7500..d048e79 100644 --- a/api/buildcraft/api/core/IAreaProvider.java +++ b/api/buildcraft/api/core/IAreaProvider.java @@ -4,7 +4,6 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; - import net.minecraft.core.BlockPos; /** To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers. */ diff --git a/api/buildcraft/api/core/IEngineType.java b/api/buildcraft/api/core/IEngineType.java index b871096..3b3750b 100644 --- a/api/buildcraft/api/core/IEngineType.java +++ b/api/buildcraft/api/core/IEngineType.java @@ -1,5 +1,6 @@ package buildcraft.api.core; public interface IEngineType { + @Deprecated(forRemoval = true) String getItemModelLocation(); } diff --git a/api/buildcraft/api/core/IFakePlayerProvider.java b/api/buildcraft/api/core/IFakePlayerProvider.java index b7fad66..8defda3 100755 --- a/api/buildcraft/api/core/IFakePlayerProvider.java +++ b/api/buildcraft/api/core/IFakePlayerProvider.java @@ -1,9 +1,7 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - *

    - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. - */ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.core; import com.mojang.authlib.GameProfile; @@ -14,7 +12,7 @@ public interface IFakePlayerProvider { /** * Returns the generic buildcraft fake player. Note that you shouldn't use this anymore, as you should store the - * UUID of the real player who created the core or entity that calls this. + * UUID of the real player who created the block or entity that calls this. */ @Deprecated FakePlayer getBuildCraftPlayer(ServerLevel world); diff --git a/api/buildcraft/api/core/IFakeWorld.java b/api/buildcraft/api/core/IFakeWorld.java new file mode 100644 index 0000000..608e33d --- /dev/null +++ b/api/buildcraft/api/core/IFakeWorld.java @@ -0,0 +1,16 @@ +package buildcraft.api.core; + +import net.minecraft.core.Holder; +import net.minecraft.resources.ResourceKey; +import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.dimension.DimensionType; +import net.minecraft.world.level.storage.WritableLevelData; + +import java.util.function.Supplier; + +public abstract class IFakeWorld extends Level { + protected IFakeWorld(WritableLevelData data, ResourceKey dim, Holder dimensionType, Supplier profiler, boolean pIsClientSide, boolean p_204154_, long p_204155_) { + super(data, dim, dimensionType, profiler, pIsClientSide, p_204154_, p_204155_); + } +} diff --git a/api/buildcraft/api/core/IFluidHandlerAdv.java b/api/buildcraft/api/core/IFluidHandlerAdv.java index f15b7d1..aa8fdd9 100644 --- a/api/buildcraft/api/core/IFluidHandlerAdv.java +++ b/api/buildcraft/api/core/IFluidHandlerAdv.java @@ -5,18 +5,14 @@ import javax.annotation.Nullable; -/** - * A version of {@link IFluidHandler} that can drain a fluid that a fluid filter accepts. - */ +/** A version of {@link IFluidHandler} that can drain a fluid that a fluid filter accepts. */ public interface IFluidHandlerAdv extends IFluidHandler { - /** - * Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. + /** Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. * - * @param filter A filter to filter the possible fluids that can be extracted. + * @param filter A filter to filter the possible fluids that can be extracted. * @param maxDrain The maximum amount of fluid to drain - * @param doDrain If false, drain will only be simulated. - * @return FluidStack representing the Fluid and amount that was (or would have been, if simulated) drained. - */ + * @param doDrain If false, drain will only be simulated. + * @return FluidStack representing the Fluid and amount that was (or would have been, if simulated) drained. */ @Nullable FluidStack drain(IFluidFilter filter, int maxDrain, FluidAction doDrain); } diff --git a/api/buildcraft/api/core/IInvSlot.java b/api/buildcraft/api/core/IInvSlot.java new file mode 100644 index 0000000..d39119a --- /dev/null +++ b/api/buildcraft/api/core/IInvSlot.java @@ -0,0 +1,26 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.core; + +import net.minecraft.world.item.ItemStack; + +public interface IInvSlot { + /** Returns the slot number of the underlying Inventory. + * + * @return the slot number */ + int getIndex(); + + boolean canPutStackInSlot(ItemStack stack); + + boolean canTakeStackFromSlot(ItemStack stack); + + boolean isItemValidForSlot(ItemStack stack); + + ItemStack decreaseStackInSlot(int amount); + + ItemStack getStackInSlot(); + + void setStackInSlot(ItemStack stack); +} diff --git a/api/buildcraft/api/core/IStackFilter.java b/api/buildcraft/api/core/IStackFilter.java index aa72538..963606b 100644 --- a/api/buildcraft/api/core/IStackFilter.java +++ b/api/buildcraft/api/core/IStackFilter.java @@ -24,9 +24,7 @@ default IStackFilter and(IStackFilter filter) { return (stack) -> before.matches(stack) && filter.matches(stack); } - /** - * Returns example stack to match this filter - */ + /** Returns example stack to match this filter */ default NonNullList getExamples() { return NonNullList.withSize(0, ItemStack.EMPTY); } diff --git a/api/buildcraft/api/core/InvalidInputDataException.java b/api/buildcraft/api/core/InvalidInputDataException.java index 866c36c..6e90933 100644 --- a/api/buildcraft/api/core/InvalidInputDataException.java +++ b/api/buildcraft/api/core/InvalidInputDataException.java @@ -8,9 +8,7 @@ import java.io.IOException; -/** - * Indicates that we failed to load from NBT or some other file. - */ +/** Indicates that we failed to load from NBT or some other file. */ public class InvalidInputDataException extends IOException { public InvalidInputDataException() { } diff --git a/api/buildcraft/api/core/JavaTools.java b/api/buildcraft/api/core/JavaTools.java new file mode 100644 index 0000000..7b7eb51 --- /dev/null +++ b/api/buildcraft/api/core/JavaTools.java @@ -0,0 +1,39 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.core; + +import java.util.Arrays; + +public final class JavaTools { + private JavaTools() { + + } + + public static T[] concat(T[] first, T[] second) { + T[] result = Arrays.copyOf(first, first.length + second.length); + System.arraycopy(second, 0, result, first.length, second.length); + return result; + } + + public static int[] concat(int[] first, int[] second) { + int[] result = Arrays.copyOf(first, first.length + second.length); + System.arraycopy(second, 0, result, first.length, second.length); + return result; + } + + public static float[] concat(float[] first, float[] second) { + float[] result = Arrays.copyOf(first, first.length + second.length); + System.arraycopy(second, 0, result, first.length, second.length); + return result; + } + + public static String surroundWithQuotes(String stringToSurroundWithQuotes) { + return String.format("\"%s\"", stringToSurroundWithQuotes); + } + + public static String stripSurroundingQuotes(String stringToStripQuotes) { + return stringToStripQuotes.replaceAll("^\"|\"$", ""); + } +} diff --git a/api/buildcraft/api/core/SafeTimeTracker.java b/api/buildcraft/api/core/SafeTimeTracker.java index 6b87cb5..d9596a7 100644 --- a/api/buildcraft/api/core/SafeTimeTracker.java +++ b/api/buildcraft/api/core/SafeTimeTracker.java @@ -49,15 +49,13 @@ public boolean markTimeIfDelay(Level world, long delay) { if (currentTime < lastMark) { lastMark = currentTime; return false; - } - else if (lastMark + delay + lastRandomDelay <= currentTime) { + } else if (lastMark + delay + lastRandomDelay <= currentTime) { duration = currentTime - lastMark; lastMark = currentTime; lastRandomDelay = (int) (Math.random() * randomRange); return true; - } - else { + } else { return false; } } diff --git a/api/buildcraft/api/core/StackKey.java b/api/buildcraft/api/core/StackKey.java new file mode 100644 index 0000000..3405e90 --- /dev/null +++ b/api/buildcraft/api/core/StackKey.java @@ -0,0 +1,135 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.core; + +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.material.Fluid; +import net.minecraftforge.fluids.FluidStack; + +/** This class is used whenever stacks needs to be stored as keys. */ +public final class StackKey { + public final ItemStack stack; + public final FluidStack fluidStack; + + public StackKey(FluidStack fluidStack) { + this(null, fluidStack); + } + + public StackKey(ItemStack stack) { + this(stack, null); + } + + public StackKey(ItemStack stack, FluidStack fluidStack) { + this.stack = stack; + this.fluidStack = fluidStack; + } + + // public static StackKey stack(Item item, int amount, int damage) + public static StackKey stack(Item item, int amount) { +// return new StackKey(new ItemStack(item, amount, damage)); + return new StackKey(new ItemStack(item, amount)); + } + + // public static StackKey stack(Block block, int amount, int damage) + public static StackKey stack(Block block, int amount) { +// return new StackKey(new ItemStack(block, amount, damage)); + return new StackKey(new ItemStack(block, amount)); + } + + public static StackKey stack(Item item) { +// return new StackKey(new ItemStack(item, 1, 0)); + return new StackKey(new ItemStack(item, 1)); + } + + public static StackKey stack(Block block) { +// return new StackKey(new ItemStack(block, 1, 0)); + return new StackKey(new ItemStack(block, 1)); + } + + public static StackKey stack(ItemStack itemStack) { + return new StackKey(itemStack); + } + + public static StackKey fluid(Fluid fluid, int amount) { + return new StackKey(new FluidStack(fluid, amount)); + } + + public static StackKey fluid(Fluid fluid) { + return new StackKey(new FluidStack(fluid, 1000)); + } + + public static StackKey fluid(FluidStack fluidStack) { + return new StackKey(fluidStack); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || o.getClass() != StackKey.class) { + return false; + } + StackKey k = (StackKey) o; + if ((stack == null ^ k.stack == null) || (fluidStack == null ^ k.fluidStack == null)) { + return false; + } + if (stack != null) { + if ( + stack.getItem() != k.stack.getItem() +// || stack.getHasSubtypes() + && stack.getDamageValue() != k.stack.getDamageValue() + || !objectsEqual(stack.getTag(), k.stack.getTag()) + ) + { + return false; + } + } + if (fluidStack != null) { + if (!fluidStack.isFluidEqual(k.fluidStack) || fluidStack.getAmount() != k.fluidStack.getAmount()) { + return false; + } + } + return true; + } + + @Override + public int hashCode() { + int result = 7; + if (stack != null) { + result = 31 * result + stack.getItem().hashCode(); + result = 31 * result + stack.getDamageValue(); + result = 31 * result + objectHashCode(stack.getTag()); + } + result = 31 * result + 7; + if (fluidStack != null) { +// result = 31 * result + fluidStack.getFluid().getName().hashCode(); + result = 31 * result + fluidStack.getFluid().getRegistryName().hashCode(); + result = 31 * result + fluidStack.getAmount(); + result = 31 * result + objectHashCode(fluidStack.getTag()); + } + return result; + } + + private boolean objectsEqual(Object o1, Object o2) { + if (o1 == null && o2 == null) { + return true; + } else if (o1 == null || o2 == null) { + return false; + } else { + return o1.equals(o2); + } + } + + private int objectHashCode(Object o) { + return o != null ? o.hashCode() : 0; + } + + public StackKey copy() { + return new StackKey(stack != null ? stack.copy() : null, fluidStack != null ? fluidStack.copy() : null); + } +} diff --git a/api/buildcraft/api/core/package-info.java b/api/buildcraft/api/core/package-info.java index 602efd6..1f2a297 100644 --- a/api/buildcraft/api/core/package-info.java +++ b/api/buildcraft/api/core/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "2.2", owner = "buildcraftlib", provides = "buildcraftapi_core") package buildcraft.api.core; - diff --git a/api/buildcraft/api/crops/CropManager.java b/api/buildcraft/api/crops/CropManager.java index 227f75f..cf439e2 100644 --- a/api/buildcraft/api/crops/CropManager.java +++ b/api/buildcraft/api/crops/CropManager.java @@ -82,5 +82,4 @@ public static boolean harvestCrop(Level world, BlockPos pos, NonNullList drops); } diff --git a/api/buildcraft/api/crops/package-info.java b/api/buildcraft/api/crops/package-info.java index e0354cf..b91544f 100644 --- a/api/buildcraft/api/crops/package-info.java +++ b/api/buildcraft/api/crops/package-info.java @@ -4,5 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_crops") package buildcraft.api.crops; - -//import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/data/NbtSquishConstants.java b/api/buildcraft/api/data/NbtSquishConstants.java index 7f3d204..2715501 100644 --- a/api/buildcraft/api/data/NbtSquishConstants.java +++ b/api/buildcraft/api/data/NbtSquishConstants.java @@ -1,6 +1,5 @@ package buildcraft.api.data; - import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtAccounter; import net.minecraft.nbt.NbtIo; diff --git a/api/buildcraft/api/enums/EnumEngineType.java b/api/buildcraft/api/enums/EnumEngineType.java index 2c86ef4..b3f6b72 100644 --- a/api/buildcraft/api/enums/EnumEngineType.java +++ b/api/buildcraft/api/enums/EnumEngineType.java @@ -1,61 +1,28 @@ package buildcraft.api.enums; import buildcraft.api.core.IEngineType; -import buildcraft.lib.client.model.ModelHolderVariable; -import buildcraft.lib.client.model.MutableQuad; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.core.Direction; import net.minecraft.util.StringRepresentable; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; public enum EnumEngineType implements StringRepresentable, IEngineType { WOOD("core", "wood"), STONE("energy", "stone"), IRON("energy", "iron"), - // CREATIVE("energy", "creative"), + // CREATIVE("energy", "creative"), CREATIVE("core", "creative"), ; public final String unlocalizedTag; + @Deprecated(forRemoval = true) public final String resourceLocation; public static final EnumEngineType[] VALUES = values(); - // Calen - @OnlyIn(Dist.CLIENT) - private ModelHolderVariable model; - @OnlyIn(Dist.CLIENT) - private TextureAtlasSprite particle; - EnumEngineType(String mod, String loc) { unlocalizedTag = loc; resourceLocation = "buildcraft" + mod + ":blocks/engine/inv/" + loc; } - @OnlyIn(Dist.CLIENT) - public void setModel(ModelHolderVariable model) { - this.model = model; - } - - @OnlyIn(Dist.CLIENT) - public ModelHolderVariable getModel() { - return model; - } - - @OnlyIn(Dist.CLIENT) - public TextureAtlasSprite getPticle() { - if (particle == null) { - for (MutableQuad quad : model.getCutoutQuads()) { - if (quad.getFace() == Direction.DOWN) { - particle = quad.getSprite(); - break; - } - } - } - return particle; - } - + @Deprecated(forRemoval = true) @Override public String getItemModelLocation() { return resourceLocation; @@ -66,10 +33,10 @@ public String getSerializedName() { return unlocalizedTag; } - public static EnumEngineType fromMeta(int meta) { - if (meta < 0 || meta >= VALUES.length) { - meta = 0; - } - return VALUES[meta]; - } +// public static EnumEngineType fromMeta(int meta) { +// if (meta < 0 || meta >= VALUES.length) { +// meta = 0; +// } +// return VALUES[meta]; +// } } diff --git a/api/buildcraft/api/enums/EnumExchangePart.java b/api/buildcraft/api/enums/EnumExchangePart.java deleted file mode 100644 index 13527b3..0000000 --- a/api/buildcraft/api/enums/EnumExchangePart.java +++ /dev/null @@ -1,18 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.util.StringRepresentable; - -import java.util.Locale; - -public enum EnumExchangePart implements StringRepresentable { - START, - MIDDLE, - END; - - private final String lowerCaseName = name().toLowerCase(Locale.ROOT); - - @Override - public String getSerializedName() { - return lowerCaseName; - } -} diff --git a/api/buildcraft/api/enums/EnumRedstoneChipset.java b/api/buildcraft/api/enums/EnumRedstoneChipset.java index b10c886..f7c5e7d 100644 --- a/api/buildcraft/api/enums/EnumRedstoneChipset.java +++ b/api/buildcraft/api/enums/EnumRedstoneChipset.java @@ -1,15 +1,14 @@ package buildcraft.api.enums; -import buildcraft.silicon.BCSiliconItems; -import buildcraft.silicon.item.ItemRedstoneChipset; +import buildcraft.api.BCItems; +import buildcraft.api.items.IChipset; import net.minecraft.util.StringRepresentable; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.registries.RegistryObject; import java.util.Locale; -//public enum EnumRedstoneChipset implements IStringSerializable +// public enum EnumRedstoneChipset implements IStringSerializable public enum EnumRedstoneChipset implements StringRepresentable { RED, IRON, @@ -20,31 +19,17 @@ public enum EnumRedstoneChipset implements StringRepresentable { private final String name = name().toLowerCase(Locale.ROOT); public ItemStack getStack(int stackSize) { -// Item chipset = BCItems.Silicon.REDSTONE_CHIPSET; - RegistryObject chipset = BCSiliconItems.chipsetRedstone; + Item chipset = switch (this) { + case RED -> BCItems.Silicon.CHIPSET_REDSTONE; + case IRON -> BCItems.Silicon.CHIPSET_IRON; + case GOLD -> BCItems.Silicon.CHIPSET_GOLD; + case QUARTZ -> BCItems.Silicon.CHIPSET_QUARTZ; + case DIAMOND -> BCItems.Silicon.CHIPSET_DIAMOND; + }; if (chipset == null) { return ItemStack.EMPTY; - } - // ordinal() -> meta - // 0 红石 - // 1 铁 - // 2 金 - // 3 石英 - // 4 钻石 -// return new ItemStack(chipset, stackSize, ordinal()); - switch (this) { - case RED: - return new ItemStack(BCSiliconItems.chipsetRedstone.get(), stackSize); - case IRON: - return new ItemStack(BCSiliconItems.chipsetIron.get(), stackSize); - case GOLD: - return new ItemStack(BCSiliconItems.chipsetGold.get(), stackSize); - case QUARTZ: - return new ItemStack(BCSiliconItems.chipsetQuartz.get(), stackSize); - case DIAMOND: - return new ItemStack(BCSiliconItems.chipsetDiamond.get(), stackSize); - default: - return ItemStack.EMPTY; + } else { + return new ItemStack(BCItems.Silicon.CHIPSET_GOLD, stackSize); } } @@ -54,11 +39,11 @@ public ItemStack getStack() { public static EnumRedstoneChipset fromStack(ItemStack stack) { // if (stack == null) - if (stack == null || stack.getItem().getClass() != ItemRedstoneChipset.class) { + if (stack == null || !(stack.getItem() instanceof IChipset)) { return RED; } // return fromOrdinal(stack.getMetadata()); - return ((ItemRedstoneChipset) stack.getItem()).type; + return ((IChipset) stack.getItem()).getType(); } public static EnumRedstoneChipset fromOrdinal(int ordinal) { diff --git a/api/buildcraft/api/enums/EnumSpring.java b/api/buildcraft/api/enums/EnumSpring.java index 22c90a6..7c6bcaa 100644 --- a/api/buildcraft/api/enums/EnumSpring.java +++ b/api/buildcraft/api/enums/EnumSpring.java @@ -1,5 +1,6 @@ package buildcraft.api.enums; +import buildcraft.api.blocks.ISpring; import net.minecraft.core.BlockPos; import net.minecraft.util.StringRepresentable; import net.minecraft.world.level.block.Blocks; @@ -18,7 +19,7 @@ public enum EnumSpring implements StringRepresentable { public final int tickRate, chance; public BlockState liquidBlock; public boolean canGen = true; - // public Supplier tileConstructor; + // public Supplier tileConstructor; public BiFunction tileConstructor; private final String lowerCaseName = name().toLowerCase(Locale.ROOT); @@ -29,9 +30,14 @@ public enum EnumSpring implements StringRepresentable { this.liquidBlock = liquidBlock; } -// public static EnumSpring fromState(BlockState state) { + public static EnumSpring fromState(BlockState state) { // return state.getValue(BuildCraftProperties.SPRING_TYPE); -// } + if (state.getBlock() instanceof ISpring spring) { + return spring.getType(); + } else { + return null; + } + } @Override public String getSerializedName() { diff --git a/api/buildcraft/api/enums/package-info.java b/api/buildcraft/api/enums/package-info.java index c3eb5c7..49f7dd0 100644 --- a/api/buildcraft/api/enums/package-info.java +++ b/api/buildcraft/api/enums/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_enums") package buildcraft.api.enums; - diff --git a/api/buildcraft/api/events/BlockInteractionEvent.java b/api/buildcraft/api/events/BlockInteractionEvent.java index a17f7a1..8a1bb8a 100644 --- a/api/buildcraft/api/events/BlockInteractionEvent.java +++ b/api/buildcraft/api/events/BlockInteractionEvent.java @@ -4,7 +4,6 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.events; - import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.eventbus.api.Cancelable; diff --git a/api/buildcraft/api/events/RobotPlacementEvent.java b/api/buildcraft/api/events/RobotPlacementEvent.java index 5494229..6c057f4 100644 --- a/api/buildcraft/api/events/RobotPlacementEvent.java +++ b/api/buildcraft/api/events/RobotPlacementEvent.java @@ -17,5 +17,4 @@ public RobotPlacementEvent(Player player, String robotProgram) { this.player = player; this.robotProgram = robotProgram; } - } diff --git a/api/buildcraft/api/events/package-info.java b/api/buildcraft/api/events/package-info.java index 1fc1b49..dbbc4cc 100644 --- a/api/buildcraft/api/events/package-info.java +++ b/api/buildcraft/api/events/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_events") package buildcraft.api.events; - diff --git a/api/buildcraft/api/facades/FacadeAPI.java b/api/buildcraft/api/facades/FacadeAPI.java index e546df4..626eeb0 100644 --- a/api/buildcraft/api/facades/FacadeAPI.java +++ b/api/buildcraft/api/facades/FacadeAPI.java @@ -1,6 +1,6 @@ package buildcraft.api.facades; -import buildcraft.silicon.item.ItemPluggableFacade; +import buildcraft.api.imc.BcImcMessage; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.world.item.ItemStack; @@ -17,9 +17,8 @@ public final class FacadeAPI { public static final String NBT_CUSTOM_BLOCK_META = "block_meta"; public static final String NBT_CUSTOM_ITEM_STACK = "item_stack"; - // public static IFacadeItem facadeItem; -// public static RegistryObject facadeItem; - public static RegistryObject facadeItem; + // public static IFacadeItem facadeItem; + public static RegistryObject facadeItem; public static IFacadeRegistry registry; private FacadeAPI() { @@ -28,7 +27,7 @@ private FacadeAPI() { public static void disableBlock(Block block) { // FMLInterModComms.sendMessage(IMC_MOD_TARGET, IMC_FACADE_DISABLE, block.getRegistryName()); - InterModComms.sendTo(IMC_MOD_TARGET, IMC_FACADE_DISABLE, () -> block.getRegistryName()); + InterModComms.sendTo(IMC_MOD_TARGET, IMC_FACADE_DISABLE, () -> new BcImcMessage(block.getRegistryName())); } public static void mapStateToStack(BlockState state, ItemStack stack) { @@ -38,7 +37,7 @@ public static void mapStateToStack(BlockState state, ItemStack stack) { nbt.put(NBT_CUSTOM_BLOCK_META, NbtUtils.writeBlockState(state)); nbt.put(NBT_CUSTOM_ITEM_STACK, stack.serializeNBT()); // FMLInterModComms.sendMessage(IMC_MOD_TARGET, IMC_FACADE_CUSTOM, nbt); - InterModComms.sendTo(IMC_MOD_TARGET, IMC_FACADE_CUSTOM, () -> nbt); + InterModComms.sendTo(IMC_MOD_TARGET, IMC_FACADE_CUSTOM, () -> new BcImcMessage(nbt)); } public static boolean isFacadeMessageId(String id) { diff --git a/api/buildcraft/api/facades/IFacade.java b/api/buildcraft/api/facades/IFacade.java index 1142a73..f511f3d 100644 --- a/api/buildcraft/api/facades/IFacade.java +++ b/api/buildcraft/api/facades/IFacade.java @@ -1,9 +1,13 @@ package buildcraft.api.facades; +import net.minecraft.nbt.CompoundTag; + public interface IFacade { FacadeType getType(); boolean isHollow(); IFacadePhasedState[] getPhasedStates(); + + CompoundTag writeToNbt(); } diff --git a/api/buildcraft/api/facades/IFacadeItem.java b/api/buildcraft/api/facades/IFacadeItem.java index 5477caa..bc0583c 100644 --- a/api/buildcraft/api/facades/IFacadeItem.java +++ b/api/buildcraft/api/facades/IFacadeItem.java @@ -32,4 +32,6 @@ default FacadeType getFacadeType(@Nonnull ItemStack stack) { @Nullable IFacade getFacade(@Nonnull ItemStack facade); + + ItemStack createItemStack(IFacade state); } diff --git a/api/buildcraft/api/facades/IFacadeRegistry.java b/api/buildcraft/api/facades/IFacadeRegistry.java index b861a71..c9cb903 100644 --- a/api/buildcraft/api/facades/IFacadeRegistry.java +++ b/api/buildcraft/api/facades/IFacadeRegistry.java @@ -14,6 +14,6 @@ public interface IFacadeRegistry { IFacade createPhasedFacade(IFacadePhasedState[] states, boolean isHollow); default IFacade createBasicFacade(IFacadeState state, boolean isHollow) { - return createPhasedFacade(new IFacadePhasedState[]{createPhasedState(state, null)}, isHollow); + return createPhasedFacade(new IFacadePhasedState[] { createPhasedState(state, null) }, isHollow); } } diff --git a/api/buildcraft/api/facades/package-info.java b/api/buildcraft/api/facades/package-info.java index 1241cec..7679c3a 100644 --- a/api/buildcraft/api/facades/package-info.java +++ b/api/buildcraft/api/facades/package-info.java @@ -3,5 +3,4 @@ * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_facades") -//package buildcraft.api.facades; - +package buildcraft.api.facades; diff --git a/api/buildcraft/api/filler/IFilledTemplate.java b/api/buildcraft/api/filler/IFilledTemplate.java index 2ed94c1..05af925 100644 --- a/api/buildcraft/api/filler/IFilledTemplate.java +++ b/api/buildcraft/api/filler/IFilledTemplate.java @@ -1,11 +1,8 @@ package buildcraft.api.filler; - import net.minecraft.core.BlockPos; -/** - * Use methods of the interface as much as possible, implementation can do optimizations - */ +/** Use methods of the interface as much as possible, implementation can do optimizations */ public interface IFilledTemplate { BlockPos getSize(); diff --git a/api/buildcraft/api/filler/package-info.java b/api/buildcraft/api/filler/package-info.java index 4d7ea95..e76db5e 100644 --- a/api/buildcraft/api/filler/package-info.java +++ b/api/buildcraft/api/filler/package-info.java @@ -1,7 +1,6 @@ -/* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "5.0", owner = "buildcraftapi_core", provides = "buildcraftapi_filler") package buildcraft.api.filler; - diff --git a/api/buildcraft/api/fuels/EnumCoolantType.java b/api/buildcraft/api/fuels/EnumCoolantType.java index e1256a6..a5008d6 100644 --- a/api/buildcraft/api/fuels/EnumCoolantType.java +++ b/api/buildcraft/api/fuels/EnumCoolantType.java @@ -2,13 +2,12 @@ import java.util.Locale; -// Calen public enum EnumCoolantType { FLUID, SOLID, ; - public String getlowerName() { + public String getLowerName() { return this.name().toLowerCase(Locale.ROOT); } diff --git a/api/buildcraft/api/fuels/ICoolant.java b/api/buildcraft/api/fuels/ICoolant.java index ac3fa24..464d4dd 100644 --- a/api/buildcraft/api/fuels/ICoolant.java +++ b/api/buildcraft/api/fuels/ICoolant.java @@ -1,13 +1,10 @@ package buildcraft.api.fuels; import buildcraft.api.BCModules; -import buildcraft.energy.recipe.CoolantRecipeSerializer; -import buildcraft.lib.misc.StackUtil; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.Level; import net.minecraftforge.fluids.FluidStack; @@ -28,7 +25,7 @@ default boolean matches(Container inv, Level world) { @Override default ItemStack assemble(Container inv) { - return StackUtil.EMPTY; + return ItemStack.EMPTY; } @Override @@ -38,7 +35,7 @@ default boolean canCraftInDimensions(int width, int height) { @Override default ItemStack getResultItem() { - return StackUtil.EMPTY; + return ItemStack.EMPTY; } @Override @@ -46,11 +43,6 @@ default boolean isSpecial() { return true; } - @Override - default RecipeSerializer getSerializer() { - return CoolantRecipeSerializer.INSTANCE; - } - @Override default RecipeType getType() { return TYPE; diff --git a/api/buildcraft/api/fuels/ICoolantManager.java b/api/buildcraft/api/fuels/ICoolantManager.java index 4c11a7e..629c002 100644 --- a/api/buildcraft/api/fuels/ICoolantManager.java +++ b/api/buildcraft/api/fuels/ICoolantManager.java @@ -1,9 +1,7 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - *

    - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. - */ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.fuels; import net.minecraft.resources.ResourceLocation; @@ -15,36 +13,36 @@ import java.util.Collection; public interface ICoolantManager { - // IFluidCoolant addCoolant(IFluidCoolant coolant); + // IFluidCoolant addCoolant(IFluidCoolant coolant); IFluidCoolant addUnregisteredFluidCoolant(IFluidCoolant coolant); - // IFluidCoolant addCoolant(FluidStack fluid, float degreesCoolingPerMb); + // IFluidCoolant addCoolant(FluidStack fluid, float degreesCoolingPerMb); IFluidCoolant addCoolant(ResourceLocation id, FluidStack fluid, float degreesCoolingPerMb); - // default IFluidCoolant addCoolant(Fluid fluid, float degreesCoolingPerMb) + // default IFluidCoolant addCoolant(Fluid fluid, float degreesCoolingPerMb) default IFluidCoolant addCoolant(ResourceLocation id, Fluid fluid, float degreesCoolingPerMb) { // return addCoolant(new FluidStack(fluid, 1), degreesCoolingPerMb); return addCoolant(id, new FluidStack(fluid, 1), degreesCoolingPerMb); } - // ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); + // ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); ISolidCoolant addUnregisteredSolidCoolant(ISolidCoolant solidCoolant); - // ISolidCoolant addSolidCoolant(ItemStack solid, FluidStack fluid, float multiplier); + // ISolidCoolant addSolidCoolant(ItemStack solid, FluidStack fluid, float multiplier); ISolidCoolant addSolidCoolant(ResourceLocation id, ItemStack solid, FluidStack fluid, float multiplier); - // Collection getCoolants(); + // Collection getCoolants(); Collection getCoolants(Level world); - // Collection getSolidCoolants(); + // Collection getSolidCoolants(); Collection getSolidCoolants(Level world); - // IFluidCoolant getCoolant(FluidStack fluid); + // IFluidCoolant getCoolant(FluidStack fluid); IFluidCoolant getCoolant(Level world, FluidStack fluid); - // float getDegreesPerMb(FluidStack fluid, float heat); + // float getDegreesPerMb(FluidStack fluid, float heat); float getDegreesPerMb(Level world, FluidStack fluid, float heat); - // ISolidCoolant getSolidCoolant(ItemStack solid); + // ISolidCoolant getSolidCoolant(ItemStack solid); ISolidCoolant getSolidCoolant(Level world, ItemStack solid); } diff --git a/api/buildcraft/api/fuels/IFluidCoolant.java b/api/buildcraft/api/fuels/IFluidCoolant.java index 7b6c6ea..b0fee8d 100644 --- a/api/buildcraft/api/fuels/IFluidCoolant.java +++ b/api/buildcraft/api/fuels/IFluidCoolant.java @@ -1,16 +1,16 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - *

    - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. - */ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.fuels; import net.minecraftforge.fluids.FluidStack; -// Calen: ICoolant 1.12.2 -> IFluidCoolant 1.18.2 -// 1.18.2 new class ICoolant super ICoolant, IFluidCoolant -//public interface ICoolant +/** + * This was named ICoolant in 1.12.2. + * In 1.18.2, we differ coolants as {@link EnumCoolantType#FLUID} AND {@link EnumCoolantType#SOLID}., + * {@link IFluidCoolant} and {@link ISolidCoolant} both extends {@link ICoolant}. + */ public interface IFluidCoolant extends ICoolant { boolean matchesFluid(FluidStack fluid); @@ -19,5 +19,6 @@ public interface IFluidCoolant extends ICoolant { * @return 0 if the input fluid provides no cooling, or a value greater than 0 if it does. */ float getDegreesCoolingPerMB(FluidStack fluid, float heat); + /** @return The degrees-of-cooling-per-mb value of the recipe, ignoring whether a correct input is present. */ float getDegreesCoolingPerMB(); } diff --git a/api/buildcraft/api/fuels/IFuel.java b/api/buildcraft/api/fuels/IFuel.java index d238aec..39d1f0e 100644 --- a/api/buildcraft/api/fuels/IFuel.java +++ b/api/buildcraft/api/fuels/IFuel.java @@ -1,13 +1,10 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - *

    - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. - */ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.fuels; import buildcraft.api.BCModules; -import buildcraft.lib.misc.StackUtil; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; @@ -38,7 +35,7 @@ default boolean matches(Container inv, Level world) { @Override default ItemStack assemble(Container inv) { - return StackUtil.EMPTY; + return ItemStack.EMPTY; } @Override @@ -48,7 +45,7 @@ default boolean canCraftInDimensions(int width, int height) { @Override default ItemStack getResultItem() { - return StackUtil.EMPTY; + return ItemStack.EMPTY; } @Override @@ -56,18 +53,8 @@ default boolean isSpecial() { return true; } - // Calen @Override default RecipeType getType() { return TYPE; } - -// @Override -// public NonNullList getIngredients() -// { -// NonNullList nonnulllist = NonNullList.create(); -// nonnulllist.add(Ingredient.of); -// nonnulllist.add(this.middleInput); -// nonnulllist.add(this.bottomOptional); -// return nonnulllist; } diff --git a/api/buildcraft/api/fuels/IFuelManager.java b/api/buildcraft/api/fuels/IFuelManager.java index d9da115..2666843 100644 --- a/api/buildcraft/api/fuels/IFuelManager.java +++ b/api/buildcraft/api/fuels/IFuelManager.java @@ -1,9 +1,7 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - *

    - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. - */ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.fuels; import net.minecraft.resources.ResourceLocation; @@ -14,44 +12,37 @@ import java.util.Collection; public interface IFuelManager { - // F addFuel(F fuel); + // F addFuel(F fuel); F addUnregisteredFuel(F fuel); - // IFuel addFuel(FluidStack fluid, long powerPerCycle, int totalBurningTime); + // IFuel addFuel(FluidStack fluid, long powerPerCycle, int totalBurningTime); IFuel addUnregisteredFuel(ResourceLocation id, FluidStack fluid, long powerPerCycle, int totalBurningTime); - // default IFuel addFuel(Fluid fluid, long powerPerCycle, int totalBurningTime) + // default IFuel addFuel(Fluid fluid, long powerPerCycle, int totalBurningTime) default IFuel addUnregisteredFuel(ResourceLocation id, Fluid fluid, long powerPerCycle, int totalBurningTime) { // return addFuel(new FluidStack(fluid, 1), powerPerCycle, totalBurningTime); return addUnregisteredFuel(id, new FluidStack(fluid, 1), powerPerCycle, totalBurningTime); } - /** - * @param residue The residue fluidstack, per bucket of the original fuel. - */ + /** @param residue The residue fluidstack, per bucket of the original fuel. */ // IDirtyFuel addDirtyFuel(FluidStack fuel, long powerPerCycle, int totalBurningTime, FluidStack residue); -// IDirtyFuel addDirtyFuel(ResourceLocation id, FluidStack fuel, long powerPerCycle, int totalBurningTime, FluidStack residue); IDirtyFuel addUnregisteredDirtyFuel(ResourceLocation id, FluidStack fuel, long powerPerCycle, int totalBurningTime, FluidStack residue); - /** - * @param residue The residue fluidstack, per bucket of the original fuel. - */ + /** @param residue The residue fluidstack, per bucket of the original fuel. */ // default IDirtyFuel addDirtyFuel(Fluid fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) default IDirtyFuel addUnregisteredDirtyFuel(ResourceLocation id, Fluid fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) { // return addDirtyFuel(new FluidStack(fuel, 1), powerPerCycle, totalBurningTime, residue); return addUnregisteredDirtyFuel(id, new FluidStack(fuel, 1), powerPerCycle, totalBurningTime, residue); } - // Collection getFuels(); + // Collection getFuels(); Collection getFuels(Level world); - // IFuel getFuel(FluidStack fluid); + // IFuel getFuel(FluidStack fluid); IFuel getFuel(Level world, FluidStack fluid); interface IDirtyFuel extends IFuel { - /** - * @return The residue fluidstack, per bucket of original fuel. - */ + /** @return The residue fluidstack, per bucket of original fuel. */ FluidStack getResidue(); } } diff --git a/api/buildcraft/api/fuels/ISolidCoolant.java b/api/buildcraft/api/fuels/ISolidCoolant.java index 2d3ef19..6de111b 100644 --- a/api/buildcraft/api/fuels/ISolidCoolant.java +++ b/api/buildcraft/api/fuels/ISolidCoolant.java @@ -1,9 +1,7 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - *

    - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. - */ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.fuels; import net.minecraft.world.item.ItemStack; @@ -12,8 +10,7 @@ public interface ISolidCoolant extends ICoolant { FluidStack getFluidFromSolidCoolant(ItemStack stack); - // Calen - float getMultiplierForSerialize(); + float getMultiplier(); ItemStack getSolid(); } diff --git a/api/buildcraft/api/fuels/package-info.java b/api/buildcraft/api/fuels/package-info.java index 61f1829..1515996 100644 --- a/api/buildcraft/api/fuels/package-info.java +++ b/api/buildcraft/api/fuels/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_fuels") package buildcraft.api.fuels; - diff --git a/api/buildcraft/api/gates/package-info.java b/api/buildcraft/api/gates/package-info.java index 309dd4b..5b5928c 100644 --- a/api/buildcraft/api/gates/package-info.java +++ b/api/buildcraft/api/gates/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "4.1", owner = "buildcraftapi_core", provides = "buildcraftapi_gates") package buildcraft.api.gates; - diff --git a/api/buildcraft/api/imc/BcImcMessage.java b/api/buildcraft/api/imc/BcImcMessage.java index 2ef0c40..ef80d70 100644 --- a/api/buildcraft/api/imc/BcImcMessage.java +++ b/api/buildcraft/api/imc/BcImcMessage.java @@ -5,15 +5,12 @@ import javax.annotation.Nonnull; -// Calen: from 1.12.2 forge +/** Used in {@link buildcraft.api.facades.FacadeAPI} */ public class BcImcMessage { - @Nonnull - public final String key; @Nonnull private final Object value; - public BcImcMessage(@Nonnull String key, @Nonnull Object value) { - this.key = key; + public BcImcMessage(@Nonnull Object value) { this.value = value; } @@ -32,4 +29,4 @@ public boolean isNBTMessage() { public Class getMessageType() { return value.getClass(); } -} \ No newline at end of file +} diff --git a/api/buildcraft/api/items/FluidItemDrops.java b/api/buildcraft/api/items/FluidItemDrops.java index a9bb410..45c219e 100644 --- a/api/buildcraft/api/items/FluidItemDrops.java +++ b/api/buildcraft/api/items/FluidItemDrops.java @@ -1,6 +1,5 @@ package buildcraft.api.items; -import buildcraft.core.item.ItemFragileFluidContainer; import net.minecraft.core.NonNullList; import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -8,7 +7,7 @@ import net.minecraftforge.registries.RegistryObject; public class FluidItemDrops { - public static RegistryObject item; + public static RegistryObject item; public static void addFluidDrops(NonNullList toDrop, FluidStack... fluids) { if (item != null) { diff --git a/api/buildcraft/api/items/IChipset.java b/api/buildcraft/api/items/IChipset.java new file mode 100644 index 0000000..8914f84 --- /dev/null +++ b/api/buildcraft/api/items/IChipset.java @@ -0,0 +1,7 @@ +package buildcraft.api.items; + +import buildcraft.api.enums.EnumRedstoneChipset; + +public interface IChipset { + EnumRedstoneChipset getType(); +} diff --git a/api/buildcraft/api/items/IItemCustomPipeRender.java b/api/buildcraft/api/items/IItemCustomPipeRender.java new file mode 100644 index 0000000..581aa3f --- /dev/null +++ b/api/buildcraft/api/items/IItemCustomPipeRender.java @@ -0,0 +1,13 @@ +package buildcraft.api.items; + +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public interface IItemCustomPipeRender { + float getPipeRenderScale(ItemStack stack); + + /** @return False to use the default renderer, true otherwise. */ + @OnlyIn(Dist.CLIENT) + boolean renderItemInPipe(ItemStack stack, double x, double y, double z); +} diff --git a/api/buildcraft/api/items/INamedItem.java b/api/buildcraft/api/items/INamedItem.java index eafa7f6..225fc8d 100644 --- a/api/buildcraft/api/items/INamedItem.java +++ b/api/buildcraft/api/items/INamedItem.java @@ -5,7 +5,7 @@ import javax.annotation.Nonnull; public interface INamedItem { - // Component getName(@Nonnull ItemStack stack); + // Component getName(@Nonnull ItemStack stack); String getName_INamedItem(@Nonnull ItemStack stack); boolean setName(@Nonnull ItemStack stack, String name); diff --git a/api/buildcraft/api/items/package-info.java b/api/buildcraft/api/items/package-info.java index f8bc472..8747597 100644 --- a/api/buildcraft/api/items/package-info.java +++ b/api/buildcraft/api/items/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_items") package buildcraft.api.items; - diff --git a/api/buildcraft/api/lists/package-info.java b/api/buildcraft/api/lists/package-info.java index fae9cc7..a4456d8 100644 --- a/api/buildcraft/api/lists/package-info.java +++ b/api/buildcraft/api/lists/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_lists") package buildcraft.api.lists; - diff --git a/api/buildcraft/api/mj/MjAPI.java b/api/buildcraft/api/mj/MjAPI.java index 0fd7a32..2271188 100644 --- a/api/buildcraft/api/mj/MjAPI.java +++ b/api/buildcraft/api/mj/MjAPI.java @@ -1,9 +1,6 @@ package buildcraft.api.mj; -import buildcraft.api.BCModules; -import buildcraft.core.BCCore; import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.capabilities.Capability; @@ -16,7 +13,7 @@ import javax.annotation.Nonnull; import java.text.DecimalFormat; -@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = BCCore.MODID) +@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = "buildcraftcore") public class MjAPI { // ################################ @@ -25,18 +22,12 @@ public class MjAPI { // // ################################ - /** - * A single minecraft joule, in micro joules (the power system base unit) - */ + /** A single minecraft joule, in micro joules (the power system base unit) */ public static final long ONE_MINECRAFT_JOULE = getMjValue(); - /** - * The same as {@link #ONE_MINECRAFT_JOULE}, but a shorter field name - */ + /** The same as {@link #ONE_MINECRAFT_JOULE}, but a shorter field name */ public static final long MJ = ONE_MINECRAFT_JOULE; - /** - * The decimal format used to display values of MJ to the player. Note that this - */ + /** The decimal format used to display values of MJ to the player. Note that this */ public static final DecimalFormat MJ_DISPLAY_FORMAT = new DecimalFormat("#,##0.##"); public static IMjEffectManager EFFECT_MANAGER = NullaryEffectManager.INSTANCE; @@ -47,9 +38,7 @@ public class MjAPI { // // ############### - /** - * Formats a given MJ value to a player-oriented string. Note that this does not append "MJ" to the value. - */ + /** Formats a given MJ value to a player-oriented string. Note that this does not append "MJ" to the value. */ public static String formatMj(long microMj) { return formatMjInternal(microMj / (double) MJ); } @@ -90,13 +79,9 @@ public void createPowerLossEffect(Level world, Vec3 center, Vec3 direction, long @Nonnull public static final Capability CAP_CONNECTOR = CapabilityManager.get(new CapabilityToken<>() { }); - public static final ResourceLocation CAP_CONNECTOR_ID = new ResourceLocation(BCModules.CORE.getModId(), "mj_connector"); - @Nonnull public static final Capability CAP_RECEIVER = CapabilityManager.get(new CapabilityToken<>() { }); - public static final ResourceLocation CAP_RECEIVER_ID = new ResourceLocation(BCModules.CORE.getModId(), "mj_receiver"); - @Nonnull public static final Capability CAP_REDSTONE_RECEIVER = CapabilityManager.get(new CapabilityToken<>() { }); @@ -118,42 +103,6 @@ public static void registerCapability(RegisterCapabilitiesEvent event) { event.register(IMjPassiveProvider.class); } - // Calen 上面直接注册 -// static -// { -// CAP_CONNECTOR = CapabilitiesHelper.registerCapability(IMjConnector.class); -// CAP_RECEIVER = CapabilitiesHelper.registerCapability(IMjReceiver.class); -// CAP_REDSTONE_RECEIVER = CapabilitiesHelper.registerCapability(IMjRedstoneReceiver.class); -// CAP_READABLE = CapabilitiesHelper.registerCapability(IMjReadable.class); -// CAP_PASSIVE_PROVIDER = CapabilitiesHelper.registerCapability(IMjPassiveProvider.class); -// } -// -// public static void attachAbility(AttachCapabilitiesEvent event) -// { -// final BlockEntity be = event.getObject(); -//// if (be instanceof TileDistiller_BC8||be instanceof TilePump) -//// { -//// if (!be.getCapability(MjAPI.CAP_RECEIVER).isPresent()) -//// { -//// event.addCapability(MjAPI.CAP_RECEIVER_ID, new ICapabilityProvider() -//// { -//// @NotNull -//// @Override -//// public LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) -//// { -//// if (cap == MjAPI.CAP_RECEIVER) -//// { -//// return (LazyOptional)be.getCapability(MjAPI.CAP_RECEIVER); -////// return LazyOptional.of(() -> ((IFluidHandlerAdv)((TileBC_Neptune) be).getCapability())).cast(); -//// } -//// return LazyOptional.empty(); -//// } -//// }); -//// } -//// } -// } - - private static long getMjValue() { return 1_000_000L; } diff --git a/api/buildcraft/api/mj/MjBattery.java b/api/buildcraft/api/mj/MjBattery.java index e24edc0..4a1b7fa 100644 --- a/api/buildcraft/api/mj/MjBattery.java +++ b/api/buildcraft/api/mj/MjBattery.java @@ -51,8 +51,7 @@ public long addPower(long microJoulesToAdd, boolean simulate) { public long addPowerChecking(long microJoulesToAdd, boolean simulate) { if (isFull()) { return microJoulesToAdd; - } - else { + } else { return addPower(microJoulesToAdd, simulate); } } diff --git a/api/buildcraft/api/mj/MjCapabilityHelper.java b/api/buildcraft/api/mj/MjCapabilityHelper.java index 9b35fa1..ae9a9a1 100644 --- a/api/buildcraft/api/mj/MjCapabilityHelper.java +++ b/api/buildcraft/api/mj/MjCapabilityHelper.java @@ -8,9 +8,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** - * Provides a quick way to return all types of a single {@link IMjConnector} for all the different capabilities. - */ +/** Provides a quick way to return all types of a single {@link IMjConnector} for all the different capabilities. */ public class MjCapabilityHelper implements ICapabilityProvider { @Nonnull @@ -36,12 +34,9 @@ public MjCapabilityHelper(@Nonnull IMjConnector mj) { this.provider = mj instanceof IMjPassiveProvider ? (IMjPassiveProvider) mj : null; } - // Calen: getCapability(...).isPresent() - // @Override -// public boolean hasCapability(@Nonnull Capability capability, Direction facing) -// { -//// return getCapability(capability, facing) != null; -// return getCapability(capability, facing).isPresent(); +// @Override +// public boolean hasCapability(@Nonnull Capability capability, EnumFacing facing) { +// return getCapability(capability, facing) != null; // } @Override diff --git a/api/buildcraft/api/net/IMessage.java b/api/buildcraft/api/net/IMessage.java new file mode 100644 index 0000000..612c15c --- /dev/null +++ b/api/buildcraft/api/net/IMessage.java @@ -0,0 +1,21 @@ +package buildcraft.api.net; + +import buildcraft.api.core.BCLog; +import net.minecraft.network.FriendlyByteBuf; + +public interface IMessage { + void fromBytes(FriendlyByteBuf buf); + + void toBytes(FriendlyByteBuf buf); + + public static IMessage staticFromBytes(Class clazz, FriendlyByteBuf buf) { + try { + IMessage message = clazz.newInstance(); + message.fromBytes(buf); + return message; + } catch (Exception e) { + BCLog.logger.error(e); + return null; + } + } +} diff --git a/api/buildcraft/api/net/IMessageHandler.java b/api/buildcraft/api/net/IMessageHandler.java new file mode 100644 index 0000000..6a82a0e --- /dev/null +++ b/api/buildcraft/api/net/IMessageHandler.java @@ -0,0 +1,7 @@ +package buildcraft.api.net; + +import net.minecraftforge.network.NetworkEvent; + +public interface IMessageHandler { + REPLY onMessage(REQ message, NetworkEvent.Context ctx); +} diff --git a/api/buildcraft/api/power/package-info.java b/api/buildcraft/api/power/package-info.java index 9b10296..6f368b4 100644 --- a/api/buildcraft/api/power/package-info.java +++ b/api/buildcraft/api/power/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "1.3", owner = "buildcraftapi_core", provides = "buildcraftapi_power") package buildcraft.api.power; - diff --git a/api/buildcraft/api/properties/BuildCraftProperties.java b/api/buildcraft/api/properties/BuildCraftProperties.java index 4b7a7f2..d7c186a 100644 --- a/api/buildcraft/api/properties/BuildCraftProperties.java +++ b/api/buildcraft/api/properties/BuildCraftProperties.java @@ -12,12 +12,12 @@ import java.util.Map; public final class BuildCraftProperties { - public static final Property BLOCK_FACING = EnumProperty.create("facing", Direction.class, new Direction[]{Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST}); + public static final Property BLOCK_FACING = EnumProperty.create("facing", Direction.class, new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST }); public static final Property BLOCK_FACING_6 = EnumProperty.create("facing", Direction.class); public static final Property BLOCK_COLOR = EnumProperty.create("color", DyeColor.class); - // public static final EnumProperty SPRING_TYPE = EnumProperty.create("type", EnumSpring.class); - public static final Property ENGINE_TYPE = EnumProperty.create("type", EnumEngineType.class); + // public static final EnumProperty SPRING_TYPE = EnumProperty.create("type", EnumSpring.class); +// public static final Property ENGINE_TYPE = EnumProperty.create("type", EnumEngineType.class); public static final Property LASER_TABLE_TYPE = EnumProperty.create("type", EnumLaserTableType.class); public static final Property MACHINE_STATE = EnumProperty.create("state", EnumMachineState.class); public static final Property ENERGY_STAGE = EnumProperty.create("stage", EnumPowerStage.class); @@ -26,13 +26,11 @@ public final class BuildCraftProperties { public static final Property GENERIC_PIPE_DATA = IntegerProperty.create("pipe_data", 0, 15); public static final Property LED_POWER = IntegerProperty.create("led_power", 0, 3); -// // Calen: [/ 8] for pump oil [* 7 / 8] -// public static final Property SPRING_TOTAL_SOURCE = IntegerProperty.create("spring_total_source", 0, Integer.MAX_VALUE / 8); public static final Property JOINED_BELOW = BooleanProperty.create("joined_below"); // 这里的注册名就是model文件里的条件 public static final Property MOVING = BooleanProperty.create("moving"); public static final Property LED_DONE = BooleanProperty.create("led_done"); - public static final Property ACTIVE = BooleanProperty.create("active"); + // public static final Property ACTIVE = BooleanProperty.create("active"); // set but never used public static final Property VALID = BooleanProperty.create("valid"); public static final Property CONNECTED_UP = BooleanProperty.create("connected_up"); @@ -47,30 +45,20 @@ public final class BuildCraftProperties { // Block state setting flags -these are used by Level.markAndNotifyBlock and Level.setBlockState. These flags can be // added together to pass the additions public static final int UPDATE_NONE = 0; - /** - * This updates the neighbouring blocks that the new core is set. It also updates the comparator output of this - * core. - */ + /** This updates the neighbouring blocks that the new block is set. It also updates the comparator output of this + * block. */ public static final int UPDATE_NEIGHBOURS = 1; - /** - * This will mark the core for an update next tick, as well as send an update to the client (if this is a server - * world). - */ + /** This will mark the block for an update next tick, as well as send an update to the client (if this is a server + * world). */ public static final int MARK_BLOCK_FOR_UPDATE = 2; - /** - * This will mark the core for an update, even if this is a client world. It is useless to use this if - * world.isRemote returns false. - */ + /** This will mark the block for an update, even if this is a client world. It is useless to use this if + * world.isRemote returns false. */ public static final int UPDATE_EVEN_CLIENT = 4 + MARK_BLOCK_FOR_UPDATE; // 6 // Pre-added flags- pass these as-is to the Level.markAndNotifyBlock and Level.setBlockState methods. - /** - * This will do what both {@link #UPDATE_NEIGHBOURS} and {@link #MARK_BLOCK_FOR_UPDATE} do. - */ + /** This will do what both {@link #UPDATE_NEIGHBOURS} and {@link #MARK_BLOCK_FOR_UPDATE} do. */ public static final int MARK_THIS_AND_NEIGHBOURS = UPDATE_NEIGHBOURS + MARK_BLOCK_FOR_UPDATE; - /** - * This will update everything about this core. - */ + /** This will update everything about this block. */ public static final int UPDATE_ALL = UPDATE_NEIGHBOURS + MARK_BLOCK_FOR_UPDATE + UPDATE_EVEN_CLIENT; static { @@ -84,15 +72,7 @@ public final class BuildCraftProperties { CONNECTED_MAP = Maps.immutableEnumMap(map); } -// // 初始化一下 否则spring block拿到的BuildCraftProperties.SPRING_TYPE是null? -// public static void init() -// { -// new BuildCraftProperties(); -// } - - /** - * Deactivate constructor - */ + /** Deactivate constructor */ private BuildCraftProperties() { } } diff --git a/api/buildcraft/api/recipes/AssemblyRecipe.java b/api/buildcraft/api/recipes/AssemblyRecipe.java deleted file mode 100644 index 96057b8..0000000 --- a/api/buildcraft/api/recipes/AssemblyRecipe.java +++ /dev/null @@ -1,137 +0,0 @@ -package buildcraft.api.recipes; - -import buildcraft.silicon.BCSilicon; -import buildcraft.silicon.recipe.AssemblyRecipeSerializer; -import net.minecraft.core.NonNullList; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.Container; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraft.world.item.crafting.RecipeType; -import net.minecraft.world.level.Level; -import net.minecraftforge.registries.IForgeRegistryEntry; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.Set; - -/** - * @deprecated TEMPORARY CLASS DO NOT USE! - */ -@Deprecated -//public abstract class AssemblyRecipe implements Comparable, IForgeRegistryEntry -public abstract class AssemblyRecipe implements Comparable, IForgeRegistryEntry, Recipe { - public static final ResourceLocation TYPE_ID = new ResourceLocation(BCSilicon.MODID, "assembly"); - - public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); - - private ResourceLocation name; - - /** - * The outputs this recipe can generate with any of the given inputs - * - * @param inputs Current ingredients in the assembly table - * @return A Set containing all possible outputs given the given inputs or an empty one if nothing can be assembled from the given inputs - */ - public abstract Set getOutputs(NonNullList inputs); - - /** - * Used to determine all outputs from this recipe for recipe previews (guide book and/or JEI) - */ - public abstract Set getOutputPreviews(); - - /** - * Used to determine what items to use up for the given output - * - * @param output The output we want to know the inputs for, only ever called using stacks obtained from getOutputs or getOutputPreviews - */ - public abstract Set getInputsFor(@Nonnull ItemStack output); - - /** - * Used to determine how much MJ is required to asemble the given output item - * - * @param output The output we want to know the MJ cost for, only ever called using stacks obtained from getOutputs or getOutputPreviews - */ - public abstract long getRequiredMicroJoulesFor(@Nonnull ItemStack output); - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - AssemblyRecipe that = (AssemblyRecipe) o; - - return name.equals(that.name); - } - - @Override - public int hashCode() { - return name.hashCode(); - } - - @Override - public int compareTo(AssemblyRecipe o) { - return name.toString().compareTo(o.name.toString()); - } - - @Override - public AssemblyRecipe setRegistryName(ResourceLocation name) { - this.name = name; - return this; - } - - @Nullable - @Override - public ResourceLocation getRegistryName() { - return name; - } - - @Override - public Class getRegistryType() { - return AssemblyRecipe.class; - } - - // Calen: for serialize - public abstract long getRequiredMicroJoulesForSerialize(); - - public abstract Set getRequiredIngredientStacksForSerialize(); - - public abstract Set getOutputForSerialize(); - - // Calen: forced by Recipe - - @Override - public ResourceLocation getId() { - return name; - } - - @Override - public boolean matches(Container inv, Level world) { - return false; - } - - @Override - public boolean canCraftInDimensions(int width, int height) { - return true; - } - - @Override - public boolean isSpecial() { - return true; - } - - @Override - public RecipeSerializer getSerializer() { - return AssemblyRecipeSerializer.INSTANCE; - } - - @Override - public RecipeType getType() { - return TYPE; - } -} diff --git a/api/buildcraft/api/recipes/AssemblyRecipeBasic.java b/api/buildcraft/api/recipes/AssemblyRecipeBasic.java deleted file mode 100644 index c35a9c8..0000000 --- a/api/buildcraft/api/recipes/AssemblyRecipeBasic.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2017 SpaceToad and the BuildCraft team - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not - * distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/ - */ - -package buildcraft.api.recipes; - -import buildcraft.api.core.BuildCraftAPI; -import com.google.common.collect.ImmutableSet; -import net.minecraft.core.NonNullList; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.Container; -import net.minecraft.world.item.ItemStack; - -import javax.annotation.Nonnull; -import java.util.Collections; -import java.util.Set; - -/** - * @deprecated TEMPORARY CLASS DO NOT USE! - */ -@Deprecated -public class AssemblyRecipeBasic extends AssemblyRecipe { - - private final long requiredMicroJoules; - private final ImmutableSet requiredStacks; - private final ImmutableSet output; - - public AssemblyRecipeBasic(ResourceLocation name, long requiredMicroJoules, ImmutableSet requiredStacks, @Nonnull ItemStack output) { - this.requiredMicroJoules = requiredMicroJoules; - this.requiredStacks = ImmutableSet.copyOf(requiredStacks); - this.output = ImmutableSet.of(output); - setRegistryName(name); - } - - public AssemblyRecipeBasic(String name, long requiredMicroJoules, ImmutableSet requiredStacks, @Nonnull ItemStack output) { - this(BuildCraftAPI.nameToResourceLocation(name), requiredMicroJoules, requiredStacks, output); - } - - public AssemblyRecipeBasic(String name, long requiredMicroJoules, Set requiredStacks, @Nonnull ItemStack output) { - this(name, requiredMicroJoules, ImmutableSet.copyOf(requiredStacks), output); - } - - @Override - public Set getOutputs(NonNullList inputs) { - if ( - requiredStacks.stream().allMatch( - (definition) -> - inputs.stream().anyMatch( - (stack) -> -// !stack.isEmpty() && definition.ingredient.apply(stack) && stack.getCount() >= definition.count - !stack.isEmpty() && definition.ingredient.test(stack) && stack.getCount() >= definition.count - ) - ) - ) - return output; - return Collections.emptySet(); - } - - @Override - public Set getOutputPreviews() { - return output; - } - - @Override - public Set getInputsFor(@Nonnull ItemStack output) { - return requiredStacks; - } - - @Override - public long getRequiredMicroJoulesFor(@Nonnull ItemStack output) { - return requiredMicroJoules; - } - - // Calen - - @Override - public long getRequiredMicroJoulesForSerialize() { - return requiredMicroJoules; - } - - @Override - public Set getOutputForSerialize() { - return output; - } - - @Override - public Set getRequiredIngredientStacksForSerialize() { - return requiredStacks; - } - - @Override - public ItemStack getResultItem() { - return output.asList().get(0); - } - - @Override - public ItemStack assemble(Container inv) { - return output.asList().get(0); - } -} diff --git a/api/buildcraft/api/recipes/AssemblyRecipeType.java b/api/buildcraft/api/recipes/EnumAssemblyRecipeType.java similarity index 58% rename from api/buildcraft/api/recipes/AssemblyRecipeType.java rename to api/buildcraft/api/recipes/EnumAssemblyRecipeType.java index 8a166cc..3b8f726 100644 --- a/api/buildcraft/api/recipes/AssemblyRecipeType.java +++ b/api/buildcraft/api/recipes/EnumAssemblyRecipeType.java @@ -1,7 +1,6 @@ package buildcraft.api.recipes; -// Calen -public enum AssemblyRecipeType { +public enum EnumAssemblyRecipeType { BASIC, FACADE, } diff --git a/api/buildcraft/api/recipes/IAssemblyRecipe.java b/api/buildcraft/api/recipes/IAssemblyRecipe.java new file mode 100644 index 0000000..2663e4c --- /dev/null +++ b/api/buildcraft/api/recipes/IAssemblyRecipe.java @@ -0,0 +1,77 @@ +package buildcraft.api.recipes; + +import buildcraft.api.BCModules; +import net.minecraft.core.NonNullList; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; + +import javax.annotation.Nonnull; +import java.util.Set; + +public interface IAssemblyRecipe extends Comparable, Recipe { + public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.SILICON.getModId(), "assembly"); + + public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); + + /** + * The outputs this recipe can generate with any of the given inputs + * + * @param inputs Current ingredients in the assembly table + * @return A Set containing all possible outputs given the given inputs or an empty one if nothing can be assembled from the given inputs + */ + public abstract Set getOutputs(NonNullList inputs); + + /** Used to determine all outputs from this recipe for recipe previews (guide book and/or JEI) */ + public abstract Set getOutputPreviews(); + + /** + * Used to determine what items to use up for the given output + * + * @param output The output we want to know the inputs for, only ever called using stacks obtained from getOutputs or getOutputPreviews + */ + public abstract Set getInputsFor(@Nonnull ItemStack output); + + /** + * Used to determine how much MJ is required to asemble the given output item + * + * @param output The output we want to know the MJ cost for, only ever called using stacks obtained from getOutputs or getOutputPreviews + */ + public abstract long getRequiredMicroJoulesFor(@Nonnull ItemStack output); + + @Override + public default int compareTo(IAssemblyRecipe o) { + return getId().toString().compareTo(o.getId().toString()); + } + + public abstract long getRequiredMicroJoules(); + + public abstract Set getRequiredIngredientStacks(); + + public abstract Set getOutput(); + + // Recipe + + @Override + public default boolean matches(Container inv, Level world) { + return false; + } + + @Override + public default boolean canCraftInDimensions(int width, int height) { + return true; + } + + @Override + public default boolean isSpecial() { + return true; + } + + @Override + public default RecipeType getType() { + return TYPE; + } +} diff --git a/api/buildcraft/api/recipes/IRefineryRecipeManager.java b/api/buildcraft/api/recipes/IRefineryRecipeManager.java index ebe4dc0..0464a4d 100644 --- a/api/buildcraft/api/recipes/IRefineryRecipeManager.java +++ b/api/buildcraft/api/recipes/IRefineryRecipeManager.java @@ -14,28 +14,28 @@ import java.util.stream.Stream; public interface IRefineryRecipeManager { - // IHeatableRecipe createHeatingRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo); + // IHeatableRecipe createHeatingRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo); IHeatableRecipe createHeatingRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo); - // default IHeatableRecipe addHeatableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo) + // default IHeatableRecipe addHeatableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo) default IHeatableRecipe addUnregisteredHeatableRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo) { // return getHeatableRegistry().addRecipe(createHeatingRecipe(in, out, heatFrom, heatTo)); return getHeatableRegistry().addUnregisteredRecipe(createHeatingRecipe(id, in, out, heatFrom, heatTo)); } - // ICoolableRecipe createCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo); + // ICoolableRecipe createCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo); ICoolableRecipe createCoolableRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo); - // default ICoolableRecipe addCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo) + // default ICoolableRecipe addCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo) default ICoolableRecipe addUnregisteredCoolableRecipe(ResourceLocation id, FluidStack in, FluidStack out, int heatFrom, int heatTo) { // return getCoolableRegistry().addRecipe(createCoolableRecipe(in, out, heatFrom, heatTo)); return getCoolableRegistry().addUnregisteredRecipe(createCoolableRecipe(id, in, out, heatFrom, heatTo)); } - // IDistillationRecipe createDistillationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired); + // IDistillationRecipe createDistillationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired); IDistillationRecipe createDistillationRecipe(ResourceLocation id, FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired); - // default IDistillationRecipe addDistillationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired) + // default IDistillationRecipe addDistillationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired) default IDistillationRecipe addUnregisteredDistillationRecipe(ResourceLocation id, FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired) { // return getDistillationRegistry().addRecipe(createDistillationRecipe(in, outGas, outLiquid, powerRequired)); return getDistillationRegistry().addUnregisteredRecipe(createDistillationRecipe(id, in, outGas, outLiquid, powerRequired)); @@ -48,16 +48,12 @@ default IDistillationRecipe addUnregisteredDistillationRecipe(ResourceLocation i IRefineryRegistry getDistillationRegistry(); interface IRefineryRegistry { - /** - * @return an unmodifiable collection containing all of the distillation recipes that satisfy the given - * predicate. All of the recipe objects are guaranteed to never be null. - */ + /** @return an unmodifiable collection containing all of the distillation recipes that satisfy the given + * predicate. All of the recipe objects are guaranteed to never be null. */ // Stream getRecipes(Predicate toReturn); Stream getRecipes(Level world, Predicate toReturn); - /** - * @return an unmodifiable set containing all of the distillation recipes. - */ + /** @return an unmodifiable set containing all of the distillation recipes. */ // Collection getAllRecipes(); Collection getAllRecipes(Level world); @@ -65,16 +61,14 @@ interface IRefineryRegistry { // R getRecipeForInput(@Nullable FluidStack fluid); R getRecipeForInput(Level world, @Nullable FluidStack fluid); - // Collection removeRecipes(Predicate toRemove); + // Collection removeRecipes(Predicate toRemove); Collection removeUnregisteredRecipes(Predicate toRemove); - /** - * Adds the given recipe to the registry. Note that this will remove any existing recipes for the passed + /** Adds the given recipe to the registry. Note that this will remove any existing recipes for the passed * recipe's {@link IRefineryRecipe#in()} * * @param recipe The recipe to add. - * @return The input recipe. - */ + * @return The input recipe. */ // R addRecipe(R recipe); R addUnregisteredRecipe(R recipe); @@ -82,7 +76,7 @@ interface IRefineryRegistry { // RecipeType getRecipeType; } - // interface IRefineryRecipe + // interface IRefineryRecipe interface IRefineryRecipe extends Recipe { FluidStack in(); } diff --git a/api/buildcraft/api/recipes/IngredientStack.java b/api/buildcraft/api/recipes/IngredientStack.java index f041ed4..8dad7e8 100644 --- a/api/buildcraft/api/recipes/IngredientStack.java +++ b/api/buildcraft/api/recipes/IngredientStack.java @@ -27,7 +27,7 @@ public IngredientStack(Ingredient ingredient) { this(ingredient, 1); } - // public static IngredientStack of(Object o) + // public static IngredientStack of(Object o) public static IngredientStack of(JsonElement o) { return new IngredientStack(CraftingHelper.getIngredient(o)); } @@ -44,7 +44,6 @@ public static IngredientStack of(TagKey tag) { return new IngredientStack(Ingredient.of(tag)); } - // Calen public void toNetwork(FriendlyByteBuf buffer) { buffer.writeInt(this.count); this.ingredient.toNetwork(buffer); diff --git a/api/buildcraft/api/recipes/StackDefinition.java b/api/buildcraft/api/recipes/StackDefinition.java index c364d75..b2d5f8a 100644 --- a/api/buildcraft/api/recipes/StackDefinition.java +++ b/api/buildcraft/api/recipes/StackDefinition.java @@ -1,6 +1,5 @@ package buildcraft.api.recipes; - import buildcraft.api.core.IStackFilter; /** diff --git a/api/buildcraft/api/recipes/package-info.java b/api/buildcraft/api/recipes/package-info.java index 328eb32..0d35939 100644 --- a/api/buildcraft/api/recipes/package-info.java +++ b/api/buildcraft/api/recipes/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "3.0", owner = "buildcraftapi_core", provides = "buildcraftapi_recipes") package buildcraft.api.recipes; - diff --git a/api/buildcraft/api/registry/IScriptableRegistry.java b/api/buildcraft/api/registry/IScriptableRegistry.java index e72726a..048296e 100644 --- a/api/buildcraft/api/registry/IScriptableRegistry.java +++ b/api/buildcraft/api/registry/IScriptableRegistry.java @@ -111,8 +111,7 @@ public E get() { final E o = object; if (o != null) { return o; - } - else { + } else { throw new IllegalStateException("This object has been disabled! You must call isPresent() first!"); } } @@ -122,8 +121,7 @@ public String getDisabledReason() { final String r = reason; if (r != null) { return r; - } - else { + } else { throw new IllegalStateException("This object has not been disabled! You must call isPresent() first!"); } } diff --git a/api/buildcraft/api/robots/AIRobot.java b/api/buildcraft/api/robots/AIRobot.java index 5e27450..1d23f7e 100755 --- a/api/buildcraft/api/robots/AIRobot.java +++ b/api/buildcraft/api/robots/AIRobot.java @@ -103,8 +103,7 @@ public final void abort() { parentAI.delegateAI = null; parentAI.delegateAIAborted(this); } - } - catch (Throwable e) { + } catch (Throwable e) { e.printStackTrace(); delegateAI = null; @@ -120,13 +119,11 @@ public final void cycle() { if (delegateAI != null) { delegateAI.cycle(); - } - else { + } else { robot.getBattery().extractPower(1, getPowerCost()); update(); } - } - catch (Throwable e) { + } catch (Throwable e) { e.printStackTrace(); abort(); } @@ -148,8 +145,7 @@ public final void abortDelegateAI() { public final AIRobot getActiveAI() { if (delegateAI != null) { return delegateAI.getActiveAI(); - } - else { + } else { return this; } } @@ -184,8 +180,7 @@ public final void loadFromNBT(CompoundTag nbt) { if (sub.contains("class")) { // Migration support for 6.4.x aiRobotClass = RobotManager.getAIRobotByLegacyClassName(sub.getString("class")); - } - else { + } else { aiRobotClass = RobotManager.getAIRobotByName(sub.getString("aiName")); } if (aiRobotClass != null) { @@ -196,8 +191,7 @@ public final void loadFromNBT(CompoundTag nbt) { delegateAI.loadFromNBT(sub); } } - } - catch (Throwable e) { + } catch (Throwable e) { e.printStackTrace(); } } @@ -211,16 +205,14 @@ public static AIRobot loadAI(CompoundTag nbt, EntityRobotBase robot) { if (nbt.contains("class")) { // Migration support for 6.4.x aiRobotClass = RobotManager.getAIRobotByLegacyClassName(nbt.getString("class")); - } - else { + } else { aiRobotClass = RobotManager.getAIRobotByName(nbt.getString("aiName")); } if (aiRobotClass != null) { ai = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class).newInstance(robot); ai.loadFromNBT(nbt); } - } - catch (Throwable e) { + } catch (Throwable e) { e.printStackTrace(); } diff --git a/api/buildcraft/api/robots/DockingStation.java b/api/buildcraft/api/robots/DockingStation.java index 58242ff..7999534 100755 --- a/api/buildcraft/api/robots/DockingStation.java +++ b/api/buildcraft/api/robots/DockingStation.java @@ -51,8 +51,7 @@ public Direction side() { public EntityRobotBase robotTaking() { if (robotTakingId == EntityRobotBase.NULL_ROBOT_ID) { return null; - } - else if (robotTaking == null) { + } else if (robotTaking == null) { robotTaking = RobotManager.registryProvider.getRegistry(world).getLoadedRobot(robotTakingId); } @@ -78,8 +77,7 @@ public boolean takeAsMain(EntityRobotBase robot) { registry.take(this, robot.getRobotId()); return true; - } - else { + } else { return robotTakingId == robot.getRobotId(); } } @@ -94,8 +92,7 @@ public boolean take(EntityRobotBase robot) { registry.take(this, robot.getRobotId()); return true; - } - else { + } else { return robot.getRobotId() == robotTakingId; } } @@ -119,7 +116,7 @@ public void unsafeRelease(EntityRobotBase robot) { } public void writeToNBT(CompoundTag nbt) { - nbt.putIntArray("pos", new int[]{getPos().getX(), getPos().getY(), getPos().getZ()}); + nbt.putIntArray("pos", new int[] { getPos().getX(), getPos().getY(), getPos().getZ() }); nbt.putByte("side", (byte) side.ordinal()); nbt.putBoolean("isMain", linkIsMain); nbt.putLong("robotId", robotTakingId); @@ -133,16 +130,13 @@ public void readFromNBT(CompoundTag nbt) { int y = indexNBT.getInt("j"); int z = indexNBT.getInt("k"); pos = new BlockPos(x, y, z); - } - else { + } else { int[] array = nbt.getIntArray("pos"); if (array.length == 3) { pos = new BlockPos(array[0], array[1], array[2]); - } - else if (array.length != 0) { + } else if (array.length != 0) { BCLog.logger.warn("Found an integer array that was not the right length! (" + Arrays.toString(array) + ")"); - } - else { + } else { BCLog.logger.warn("Did not find any integer positions! This is a bug!"); } } @@ -171,8 +165,7 @@ public String toString() { public boolean linkIsDocked() { if (robotTaking() != null) { return robotTaking().getDockingStation() == this; - } - else { + } else { return false; } } diff --git a/api/buildcraft/api/robots/EntityRobotBase.java b/api/buildcraft/api/robots/EntityRobotBase.java index f389e2e..bc74a98 100755 --- a/api/buildcraft/api/robots/EntityRobotBase.java +++ b/api/buildcraft/api/robots/EntityRobotBase.java @@ -11,6 +11,7 @@ import buildcraft.api.mj.MjBattery; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -24,10 +25,8 @@ public abstract class EntityRobotBase extends LivingEntity implements IItemHandl public static final long SHUTDOWN_POWER = 0; public static final long NULL_ROBOT_ID = Long.MAX_VALUE; - public EntityRobotBase(Level par1World) { - // TODO Calen robot entity type? -// super(par1World); - super(null, par1World); + public EntityRobotBase(EntityType entityType, Level par1World) { + super(entityType, par1World); } public abstract void setItemInUse(ItemStack stack); diff --git a/api/buildcraft/api/robots/ResourceId.java b/api/buildcraft/api/robots/ResourceId.java index 9151afe..b7f17ac 100755 --- a/api/buildcraft/api/robots/ResourceId.java +++ b/api/buildcraft/api/robots/ResourceId.java @@ -24,8 +24,7 @@ public static ResourceId load(CompoundTag nbt) { if (nbt.contains("class")) { // Migration support for 6.4.x cls = RobotManager.getResourceIdByLegacyClassName(nbt.getString("class")); - } - else { + } else { cls = RobotManager.getResourceIdByName(nbt.getString("resourceName")); } @@ -33,8 +32,7 @@ public static ResourceId load(CompoundTag nbt) { id.readFromNBT(nbt); return id; - } - catch (Throwable e) { + } catch (Throwable e) { e.printStackTrace(); } diff --git a/api/buildcraft/api/robots/ResourceIdBlock.java b/api/buildcraft/api/robots/ResourceIdBlock.java index 7a8b9a9..ad235db 100755 --- a/api/buildcraft/api/robots/ResourceIdBlock.java +++ b/api/buildcraft/api/robots/ResourceIdBlock.java @@ -52,7 +52,7 @@ public int hashCode() { public void writeToNBT(CompoundTag nbt) { super.writeToNBT(nbt); - int[] arr = new int[]{pos.getX(), pos.getY(), pos.getZ()}; + int[] arr = new int[] { pos.getX(), pos.getY(), pos.getZ() }; nbt.putIntArray("pos", arr); nbt.put("side", side.writeToNBT()); diff --git a/api/buildcraft/api/robots/RobotManager.java b/api/buildcraft/api/robots/RobotManager.java index 831ea74..98dd22b 100644 --- a/api/buildcraft/api/robots/RobotManager.java +++ b/api/buildcraft/api/robots/RobotManager.java @@ -51,8 +51,7 @@ public static void registerAIRobot(Class aiRobot, String name // Check if NBT-load constructor is present try { aiRobot.getConstructor(EntityRobotBase.class); - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { throw new RuntimeException("AI class " + aiRobot.getName() + " lacks NBT load constructor! This is a bug!"); } diff --git a/api/buildcraft/api/robots/package-info.java b/api/buildcraft/api/robots/package-info.java index fef8a54..591fd15 100644 --- a/api/buildcraft/api/robots/package-info.java +++ b/api/buildcraft/api/robots/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "3.0", owner = "buildcraftapi_core", provides = "buildcraftapi_robotics") package buildcraft.api.robots; - diff --git a/api/buildcraft/api/schematics/ISchematicBlock.java b/api/buildcraft/api/schematics/ISchematicBlock.java index bdb4a9b..d250f32 100644 --- a/api/buildcraft/api/schematics/ISchematicBlock.java +++ b/api/buildcraft/api/schematics/ISchematicBlock.java @@ -1,7 +1,7 @@ package buildcraft.api.schematics; +import buildcraft.api.core.IFakeWorld; import buildcraft.api.core.InvalidInputDataException; -import buildcraft.builders.snapshot.FakeWorld; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.ItemStack; @@ -46,8 +46,8 @@ default boolean isReadyToBuild(Level world, BlockPos blockPos) { boolean build(Level world, BlockPos blockPos); - // boolean buildWithoutChecks(Level world, BlockPos blockPos); - boolean buildWithoutChecks(FakeWorld world, BlockPos blockPos); + // boolean buildWithoutChecks(Level world, BlockPos blockPos); + boolean buildWithoutChecks(IFakeWorld world, BlockPos blockPos); boolean isBuilt(Level world, BlockPos blockPos); diff --git a/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java b/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java index cd7d213..fee0270 100644 --- a/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java +++ b/api/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java @@ -14,7 +14,7 @@ import java.util.function.Supplier; public class SchematicBlockFactoryRegistry { - // private static final Set> FACTORIES = new TreeSet<>(); + // private static final Set> FACTORIES = new TreeSet<>(); private static final Set> FACTORIES = new ConcurrentSkipListSet<>(); // Calen thread safety: sometimes "air" not registered just after BCBuildersSchematics#preInit:registerSchematicFactory("air", 0, SchematicBlockAir::predicate, SchematicBlockAir::new) diff --git a/api/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java b/api/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java index d64ff82..b950a26 100644 --- a/api/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java +++ b/api/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java @@ -29,17 +29,18 @@ public static void registerFactory(String name, // Calen no usage in 1.12.2 // EntityList.class not present in 1.18.2 -// public static void registerFactory(String name, -// int priority, -// List entities, -// Supplier supplier) { -// registerFactory( -// name, -// priority, + public static void registerFactory(String name, + int priority, + List entities, + Supplier supplier) { + registerFactory( + name, + priority, // context -> entities.contains(EntityList.getKey(context.entity)), -// supplier -// ); -// } + context -> entities.contains(context.entity.getType().getRegistryName()), + supplier + ); + } public static List> getFactories() { return ImmutableList.copyOf(FACTORIES); diff --git a/api/buildcraft/api/statements/IGuiSlot.java b/api/buildcraft/api/statements/IGuiSlot.java index 7df96b3..a7b0e53 100644 --- a/api/buildcraft/api/statements/IGuiSlot.java +++ b/api/buildcraft/api/statements/IGuiSlot.java @@ -11,17 +11,13 @@ import java.util.List; public interface IGuiSlot extends IConvertable { - /** - * Every statement needs a unique tag, it should be in the format of "<modid>:<name>". + /** Every statement needs a unique tag, it should be in the format of "<modid>:<name>". * - * @return the unique id - */ + * @return the unique id */ String getUniqueTag(); - /** - * Return the description in the UI. Note that this should NEVER be called directly, instead this acts as a bridge - * for {@link #getTooltip()}. (As such this might return null or throw an exception) - */ + /** Return the description in the UI. Note that this should NEVER be called directly, instead this acts as a bridge + * for {@link #getTooltip()}. (As such this might return null or throw an exception) */ @OnlyIn(Dist.CLIENT) // String getDescription(); Component getDescription(); @@ -30,9 +26,7 @@ public interface IGuiSlot extends IConvertable { @OnlyIn(Dist.CLIENT) String getDescriptionKey(); - /** - * @return The full tooltip for the UI. - */ + /** @return The full tooltip for the UI. */ @OnlyIn(Dist.CLIENT) default List getTooltip() { // String desc = getDescription(); @@ -55,9 +49,7 @@ default List getTooltipKey() { return ImmutableList.of(desc); } - /** - * @return A sprite to show in a GUI, or null if this should not render a sprite. - */ + /** @return A sprite to show in a GUI, or null if this should not render a sprite. */ @OnlyIn(Dist.CLIENT) @Nullable ISprite getSprite(); diff --git a/api/buildcraft/api/statements/IStatement.java b/api/buildcraft/api/statements/IStatement.java index 7f769cf..361157a 100644 --- a/api/buildcraft/api/statements/IStatement.java +++ b/api/buildcraft/api/statements/IStatement.java @@ -29,8 +29,7 @@ default IStatementParameter createParameter(IStatementParameter old, int index) IStatementParameter _new = createParameter(index); if (old == null || _new == null) { return _new; - } - else if (old.getClass() == _new.getClass()) { + } else if (old.getClass() == _new.getClass()) { return old; } return _new; diff --git a/api/buildcraft/api/statements/ITriggerProvider.java b/api/buildcraft/api/statements/ITriggerProvider.java index 2f88590..a78de97 100644 --- a/api/buildcraft/api/statements/ITriggerProvider.java +++ b/api/buildcraft/api/statements/ITriggerProvider.java @@ -15,6 +15,6 @@ public interface ITriggerProvider { void addInternalSidedTriggers(Collection triggers, IStatementContainer container, @Nonnull Direction side); - /** Returns the list of triggers available to a gate next to the given core. */ + /** Returns the list of triggers available to a gate next to the given block. */ void addExternalTriggers(Collection triggers, @Nonnull Direction side, BlockEntity tile); } diff --git a/api/buildcraft/api/statements/StatementManager.java b/api/buildcraft/api/statements/StatementManager.java index 89086af..f854f5e 100644 --- a/api/buildcraft/api/statements/StatementManager.java +++ b/api/buildcraft/api/statements/StatementManager.java @@ -13,13 +13,9 @@ import java.util.*; public final class StatementManager { - // Calen: Thread Safety -> InvalidInputDataException: Unknown paramater type buildcraft:fillerParameterYDir public static Map statements = new HashMap<>(); - // public static Map statements = new ConcurrentHashMap<>(); public static Map parameters = new HashMap<>(); - // public static Map parameters = new ConcurrentHashMap<>(); public static Map paramsBuf = new HashMap<>(); - // public static Map paramsBuf = new ConcurrentHashMap<>(); private static List triggerProviders = new LinkedList<>(); private static List actionProviders = new LinkedList<>(); diff --git a/api/buildcraft/api/statements/StatementParameterItemStack.java b/api/buildcraft/api/statements/StatementParameterItemStack.java index d7b60a4..34b4be2 100755 --- a/api/buildcraft/api/statements/StatementParameterItemStack.java +++ b/api/buildcraft/api/statements/StatementParameterItemStack.java @@ -1,9 +1,7 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - *

    - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. - */ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.statements; import buildcraft.api.core.render.ISprite; @@ -27,9 +25,7 @@ public class StatementParameterItemStack implements IStatementParameter { @Nonnull private static final ItemStack EMPTY_STACK; - /** - * Immutable parameter that has the {@link ItemStack#EMPTY} as it's {@link #stack}. - */ + /** Immutable parameter that has the {@link ItemStack#EMPTY} as it's {@link #stack}. */ public static final StatementParameterItemStack EMPTY; static { @@ -54,8 +50,7 @@ public StatementParameterItemStack(CompoundTag nbt) { ItemStack read = ItemStack.of(nbt.getCompound("stack")); if (read.isEmpty()) { stack = EMPTY_STACK; - } - else { + } else { stack = read; } } @@ -86,8 +81,7 @@ public StatementParameterItemStack onClick( ) { if (stack.isEmpty()) { return EMPTY; - } - else { + } else { ItemStack newStack = stack.copy(); newStack.setCount(1); return new StatementParameterItemStack(newStack); @@ -99,9 +93,8 @@ public boolean equals(Object object) { if (object instanceof StatementParameterItemStack) { StatementParameterItemStack param = (StatementParameterItemStack) object; - return ItemStack.isSameItemSameTags(stack, param.stack); - } - else { + return ItemStack.matches(stack, param.stack); + } else { return false; } } diff --git a/api/buildcraft/api/statements/StatementSlot.java b/api/buildcraft/api/statements/StatementSlot.java index 23e1cff..55d117f 100755 --- a/api/buildcraft/api/statements/StatementSlot.java +++ b/api/buildcraft/api/statements/StatementSlot.java @@ -4,7 +4,6 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.statements; - import buildcraft.api.core.EnumPipePart; import java.util.Arrays; diff --git a/api/buildcraft/api/statements/package-info.java b/api/buildcraft/api/statements/package-info.java index 5bc8cbf..1cf5f34 100644 --- a/api/buildcraft/api/statements/package-info.java +++ b/api/buildcraft/api/statements/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_statements") package buildcraft.api.statements; - diff --git a/api/buildcraft/api/tiles/IBCTileMenuProvider.java b/api/buildcraft/api/tiles/IBCTileMenuProvider.java new file mode 100644 index 0000000..cda74c1 --- /dev/null +++ b/api/buildcraft/api/tiles/IBCTileMenuProvider.java @@ -0,0 +1,9 @@ +package buildcraft.api.tiles; + +import buildcraft.api.net.IMessage; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Player; + +public interface IBCTileMenuProvider extends MenuProvider { + public abstract IMessage onServerPlayerOpenNoSend(Player player); +} diff --git a/api/buildcraft/api/tiles/IDebuggable.java b/api/buildcraft/api/tiles/IDebuggable.java index 62769ad..3802795 100644 --- a/api/buildcraft/api/tiles/IDebuggable.java +++ b/api/buildcraft/api/tiles/IDebuggable.java @@ -1,5 +1,6 @@ package buildcraft.api.tiles; +import net.minecraft.client.resources.language.I18n; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraftforge.api.distmarker.Dist; @@ -8,21 +9,17 @@ import java.util.List; public interface IDebuggable { - /** - * Get the debug information from a tile entity as a list of strings, used for the F3 debug menu. The left and + /** Get the debug information from a tile entity as a list of strings, used for the F3 debug menu. The left and * right parameters correspond to the sides of the F3 screen. * - * @param side The side the core was clicked on, may be null if we don't know, or is the "centre" side - */ - // Calen: I18n.class doesn't exist in Server Side + * @param left {@link I18n} doesn't exist in Server Side, so we should use {@link Component}. + * @param side The side the block was clicked on, may be null if we don't know, or is the "centre" side */ // void getDebugInfo(List left, List right, Direction side); void getDebugInfo(List left, List right, Direction side); - /** - * Same as {@link #getDebugInfo(List, List, Direction)}, but only for client + /** Same as {@link #getDebugInfo(List, List, Direction)}, but only for client * - * @param side same as for {@link #getDebugInfo(List, List, Direction)} - */ + * @param side same as for {@link #getDebugInfo(List, List, Direction)} */ @OnlyIn(Dist.CLIENT) default void getClientDebugInfo(List left, List right, Direction side) { } diff --git a/api/buildcraft/api/tiles/ITickable.java b/api/buildcraft/api/tiles/ITickable.java new file mode 100644 index 0000000..9f21277 --- /dev/null +++ b/api/buildcraft/api/tiles/ITickable.java @@ -0,0 +1,42 @@ +package buildcraft.api.tiles; + +import net.minecraft.world.level.block.entity.BlockEntity; +import org.jetbrains.annotations.MustBeInvokedByOverriders; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +// From 1.12.2 MC +public interface ITickable { + /** Like the old updateEntity(), except more generic. */ + @MustBeInvokedByOverriders + default void update() { + LinkedList taskOfCurrentTile = tasks.get(this); + if (taskOfCurrentTile != null && !taskOfCurrentTile.isEmpty()) { + taskOfCurrentTile.forEach(Runnable::run); + taskOfCurrentTile.clear(); + } + } + + static final Map> tasks = new ConcurrentHashMap<>(); + + // Calen + + /** + * When world loading, BlockEntity#level may be null, or Level#getBlockState may cause dead lock + * + * @param task + * @param forceDelay If true, the task will be delayed to next update() even if the world is not null. + */ + default void runWhenWorldNotNull(Runnable task, boolean forceDelay) { + // Calen: don't create abstract method getLevel() in ITickable, because it will not be renamed when reobf, ant will become a different method from BlockEntity#getLevel. + if (forceDelay || ((BlockEntity) this).getLevel() == null) { + List tasksOfCurrentTile = tasks.computeIfAbsent(this, k -> new LinkedList<>()); + tasksOfCurrentTile.add(task); + } else { + task.run(); + } + } +} diff --git a/api/buildcraft/api/tiles/ITileAreaProvider.java b/api/buildcraft/api/tiles/ITileAreaProvider.java index 6e5a4c2..1ace48f 100644 --- a/api/buildcraft/api/tiles/ITileAreaProvider.java +++ b/api/buildcraft/api/tiles/ITileAreaProvider.java @@ -1,6 +1,5 @@ package buildcraft.api.tiles; - import buildcraft.api.core.IAreaProvider; import net.minecraft.core.BlockPos; diff --git a/api/buildcraft/api/tiles/TilesAPI.java b/api/buildcraft/api/tiles/TilesAPI.java index 64a1007..3692ce4 100644 --- a/api/buildcraft/api/tiles/TilesAPI.java +++ b/api/buildcraft/api/tiles/TilesAPI.java @@ -1,6 +1,5 @@ package buildcraft.api.tiles; -import buildcraft.lib.BCLib; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.CapabilityToken; @@ -10,7 +9,7 @@ import javax.annotation.Nonnull; -@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = BCLib.MODID) // Calen add for reg caps +@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = "buildcraftcore") public class TilesAPI { @Nonnull public static final Capability CAP_CONTROLLABLE = CapabilityManager.get(new CapabilityToken<>() { @@ -28,15 +27,6 @@ public class TilesAPI { public static final Capability CAP_TILE_AREA_PROVIDER = CapabilityManager.get(new CapabilityToken<>() { }); - // Calen: 1.18.2直接用CapabilityManager.get获取? -// static { -// CAP_CONTROLLABLE = CapabilitiesHelper.registerCapability(IControllable.class); -// CAP_HAS_WORK = CapabilitiesHelper.registerCapability(IHasWork.class); -// CAP_HEATABLE = CapabilitiesHelper.registerCapability(IHeatable.class); -// CAP_TILE_AREA_PROVIDER = CapabilitiesHelper.registerCapability(ITileAreaProvider.class); -// } - - // Calen @SubscribeEvent public static void registerCapability(RegisterCapabilitiesEvent event) { event.register(IControllable.class); diff --git a/api/buildcraft/api/tiles/package-info.java b/api/buildcraft/api/tiles/package-info.java index 6b886dc..53b1774 100644 --- a/api/buildcraft/api/tiles/package-info.java +++ b/api/buildcraft/api/tiles/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "1.2", owner = "buildcraftapi_core", provides = "buildcraftapi_tiles") package buildcraft.api.tiles; - diff --git a/api/buildcraft/api/tools/package-info.java b/api/buildcraft/api/tools/package-info.java index 50c20bc..8b081c3 100644 --- a/api/buildcraft/api/tools/package-info.java +++ b/api/buildcraft/api/tools/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_tools") package buildcraft.api.tools; - diff --git a/api/buildcraft/api/transport/EnumWirePart.java b/api/buildcraft/api/transport/EnumWirePart.java index 852fc36..311fa48 100644 --- a/api/buildcraft/api/transport/EnumWirePart.java +++ b/api/buildcraft/api/transport/EnumWirePart.java @@ -20,14 +20,10 @@ public enum EnumWirePart { public final AxisDirection x, y, z; - /** - * The bounding box for rendering a wire or selecting an already-placed wire. - */ + /** The bounding box for rendering a wire or selecting an already-placed wire. */ public final VoxelShape boundingBox; - /** - * The bounding box that is used when adding pipe wire to a pipe - */ + /** The bounding box that is used when adding pipe wire to a pipe */ public final VoxelShape boundingBoxPossible; EnumWirePart(boolean x, boolean y, boolean z) { @@ -78,16 +74,13 @@ public static EnumWirePart get(boolean x, boolean y, boolean z) { if (x) { if (y) { return z ? EAST_UP_SOUTH : EAST_UP_NORTH; - } - else { + } else { return z ? EAST_DOWN_SOUTH : EAST_DOWN_NORTH; } - } - else { + } else { if (y) { return z ? WEST_UP_SOUTH : WEST_UP_NORTH; - } - else { + } else { return z ? WEST_DOWN_SOUTH : WEST_DOWN_NORTH; } } diff --git a/api/buildcraft/api/transport/IItemPluggable.java b/api/buildcraft/api/transport/IItemPluggable.java index 10daaa2..d752ca7 100644 --- a/api/buildcraft/api/transport/IItemPluggable.java +++ b/api/buildcraft/api/transport/IItemPluggable.java @@ -21,6 +21,5 @@ public interface IItemPluggable { * @param side The side that the pluggable should be placed on * @return A pluggable to place onto the pipe */ @Nullable - PipePluggable onPlace(@Nonnull ItemStack stack, IPipeHolder holder, Direction side, Player player, - InteractionHand hand); + PipePluggable onPlace(@Nonnull ItemStack stack, IPipeHolder holder, Direction side, Player player, InteractionHand hand); } diff --git a/api/buildcraft/api/transport/IStripesHandlerBlock.java b/api/buildcraft/api/transport/IStripesHandlerBlock.java index ab3e410..e94c8da 100644 --- a/api/buildcraft/api/transport/IStripesHandlerBlock.java +++ b/api/buildcraft/api/transport/IStripesHandlerBlock.java @@ -12,7 +12,7 @@ public interface IStripesHandlerBlock { * @param direction * @param player * @param activator - * @return True if this broke a core, false otherwise (note that this handler MUST NOT return false if it has + * @return True if this broke a block, false otherwise (note that this handler MUST NOT return false if it has * changed the world in any way) */ boolean handle(Level world, BlockPos pos, Direction direction, Player player, IStripesActivator activator); } diff --git a/api/buildcraft/api/transport/IStripesRegistry.java b/api/buildcraft/api/transport/IStripesRegistry.java index 360f67d..b9819e8 100644 --- a/api/buildcraft/api/transport/IStripesRegistry.java +++ b/api/buildcraft/api/transport/IStripesRegistry.java @@ -31,7 +31,7 @@ boolean handleItem(Level world, Player player, IStripesActivator activator); - /** @return True if a handler broke a core, false otherwise (and so nothing has been done) */ + /** @return True if a handler broke a block, false otherwise (and so nothing has been done) */ boolean handleBlock(Level world, BlockPos pos, Direction direction, diff --git a/api/buildcraft/api/transport/WireNode.java b/api/buildcraft/api/transport/WireNode.java index 911b7a6..a38fe53 100644 --- a/api/buildcraft/api/transport/WireNode.java +++ b/api/buildcraft/api/transport/WireNode.java @@ -45,8 +45,7 @@ public WireNode offset(Direction face) { EnumWirePart nPart = EnumWirePart.get(nx, ny, nz); if (nx < 0 || ny < 0 || nz < 0 || nx > 1 || ny > 1 || nz > 1) { return new WireNode(pos.relative(face), nPart); - } - else { + } else { return new WireNode(pos, nPart); } } diff --git a/api/buildcraft/api/transport/package-info.java b/api/buildcraft/api/transport/package-info.java index 777f84f..ea4e143 100644 --- a/api/buildcraft/api/transport/package-info.java +++ b/api/buildcraft/api/transport/package-info.java @@ -4,4 +4,3 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ //@API(apiVersion = "5.0", owner = "buildcraftapi_core", provides = "buildcraftapi_transport") package buildcraft.api.transport; - diff --git a/api/buildcraft/api/transport/pipe/ICustomPipeConnection.java b/api/buildcraft/api/transport/pipe/ICustomPipeConnection.java index 30d9da9..41b317b 100644 --- a/api/buildcraft/api/transport/pipe/ICustomPipeConnection.java +++ b/api/buildcraft/api/transport/pipe/ICustomPipeConnection.java @@ -8,6 +8,6 @@ public interface ICustomPipeConnection { /** @return How long the connecting pipe should extend for, in addition to its normal 4/16f connection. Values less * than or equal to -4 / 16.0f indicate that the pipe will not connect at all, and will render - * as it it was not connected. */ + * as it was not connected. */ float getExtension(Level world, BlockPos pos, Direction face, BlockState state); } diff --git a/api/buildcraft/api/transport/pipe/IFlowFluid.java b/api/buildcraft/api/transport/pipe/IFlowFluid.java index 2906308..0c5b595 100644 --- a/api/buildcraft/api/transport/pipe/IFlowFluid.java +++ b/api/buildcraft/api/transport/pipe/IFlowFluid.java @@ -8,73 +8,64 @@ import net.minecraft.world.InteractionResultHolder; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import javax.annotation.Nullable; public interface IFlowFluid { - /** - * @deprecated use the version below with a simulate paramater. - */ + /** @deprecated use the version below with a simulate paramater. */ @Nullable @Deprecated default FluidStack tryExtractFluid(int millibuckets, Direction from, FluidStack filter) { // return tryExtractFluid(millibuckets, from, filter, false); - return tryExtractFluid(millibuckets, from, filter, IFluidHandler.FluidAction.EXECUTE); + return tryExtractFluid(millibuckets, from, filter, FluidAction.EXECUTE); } - /** - * @param millibuckets + /** @param millibuckets * @param from - * @param filter The fluidstack that the extracted fluid must match, or null for any fluid. - * @return The fluidstack extracted and inserted into the pipe. - */ + * @param filter The fluidstack that the extracted fluid must match, or null for any fluid. + * @return The fluidstack extracted and inserted into the pipe. */ @Nullable // FluidStack tryExtractFluid(int millibuckets, Direction from, FluidStack filter, boolean simulate); - FluidStack tryExtractFluid(int millibuckets, Direction from, FluidStack filter, IFluidHandler.FluidAction action); + FluidStack tryExtractFluid(int millibuckets, Direction from, FluidStack filter, FluidAction action); - /** - * @deprecated use the version below with a simulate paramater. - */ + /** @deprecated use the version below with a simulate paramater. */ @Deprecated default InteractionResultHolder tryExtractFluidAdv(int millibuckets, Direction from, IFluidFilter filter) { // return tryExtractFluidAdv(millibuckets, from, filter, false); - return tryExtractFluidAdv(millibuckets, from, filter, IFluidHandler.FluidAction.EXECUTE); + return tryExtractFluidAdv(millibuckets, from, filter, FluidAction.EXECUTE); } - /** - * Advanced version of {@link #tryExtractFluid(int, Direction, FluidStack, boolean)}. Note that this only works for + /** Advanced version of {@link #tryExtractFluid(int, Direction, FluidStack, FluidAction)}. Note that this only works for * instances of {@link IFluidHandler} that ALSO extends {@link IFluidHandlerAdv} * * @param millibuckets * @param from * @param filter A filter to try and match fluids. - * @return The fluidstack extracted and inserted into the pipe. If {@link InteractionResultHolder#getType()} equals + * @return The fluidstack extracted and inserted into the pipe. If {@link InteractionResultHolder#getResult()} equals * {@link InteractionResult#PASS} then it means that the {@link IFluidHandler} didn't implement - * {@link IFluidHandlerAdv} and you should call the basic version, if you can. - */ + * {@link IFluidHandlerAdv} and you should call the basic version, if you can. */ // InteractionResultHolder tryExtractFluidAdv(int millibuckets, Direction from, IFluidFilter filter, boolean simulate); - InteractionResultHolder tryExtractFluidAdv(int millibuckets, Direction from, IFluidFilter filter, IFluidHandler.FluidAction action); + InteractionResultHolder tryExtractFluidAdv(int millibuckets, Direction from, IFluidFilter filter, FluidAction action); - /** - * Attempts to insert a fluid directly into the pipe. Note that this will fail if the pipe currently contains a + /** Attempts to insert a fluid directly into the pipe. Note that this will fail if the pipe currently contains a * different fluid type. * * @param from The side that the fluid should *not* go in, or null if the fluid may flow in any direction. - * @return The amount of fluid that was accepted, or 0 if no fluid was accepted. - */ - int insertFluidsForce(FluidStack fluid, @Nullable Direction from, boolean simulate); + * @return The amount of fluid that was accepted, or 0 if no fluid was accepted. */ +// int insertFluidsForce(FluidStack fluid, @Nullable EnumFacing from, boolean simulate); + int insertFluidsForce(FluidStack fluid, @Nullable Direction from, FluidAction action); - /** - * Tries to extract fluids directly from the pipe. NOTE: This is intended for {@link PipeBehaviour} and + /** Tries to extract fluids directly from the pipe. NOTE: This is intended for {@link PipeBehaviour} and * {@link PipePluggable} implementors ONLY! This will result in very buggy behaviour if external tiles try to use * this! * - * @param min The minimum amount of fluid to extract. If less than this amount is in the given center then nothing - * will be extracted. - * @param section The section to extract from. Null means the center. - * @param simulate - * @return - */ + * @param min The minimum amount of fluid to extract. If less than this amount is in the given center then nothing + * will be extracted. + * @param section The section to extract from. Null means the center. + * @param action + * @return */ @Nullable - FluidStack extractFluidsForce(int min, int max, @Nullable Direction section, boolean simulate); +// FluidStack extractFluidsForce(int min, int max, @Nullable EnumFacing section, boolean simulate); + FluidStack extractFluidsForce(int min, int max, @Nullable Direction section, FluidAction action); } diff --git a/api/buildcraft/api/transport/pipe/IItemPipe.java b/api/buildcraft/api/transport/pipe/IItemPipe.java index e5a7004..a1472b5 100644 --- a/api/buildcraft/api/transport/pipe/IItemPipe.java +++ b/api/buildcraft/api/transport/pipe/IItemPipe.java @@ -9,7 +9,6 @@ public interface IItemPipe { PipeDefinition getDefinition(); - // Calen @Nullable DyeColor getColour(); } diff --git a/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java b/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java index 0fca004..81660a1 100644 --- a/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java +++ b/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java @@ -8,6 +8,5 @@ @OnlyIn(Dist.CLIENT) public interface IPipeBehaviourRenderer { // void render(B behaviour, double x, double y, double z, float partialTicks, BufferBuilder bb); -// public void render(B gate, float partialTicks, PoseStack poseStack, MultiBufferSource bufferSource, int combinedLight, int combinedOverlay); public void render(B gate, float partialTicks, PoseStack poseStack, VertexConsumer vertexConsumer, int combinedLight, int combinedOverlay); } diff --git a/api/buildcraft/api/transport/pipe/IPipeExtensionManager.java b/api/buildcraft/api/transport/pipe/IPipeExtensionManager.java index 51bbc3f..5a85944 100644 --- a/api/buildcraft/api/transport/pipe/IPipeExtensionManager.java +++ b/api/buildcraft/api/transport/pipe/IPipeExtensionManager.java @@ -13,9 +13,9 @@ public interface IPipeExtensionManager { /** - * Requests an extension by one core from a IStripesActivator (usually a stripes transport pipe) with the pipe supplied + * Requests an extension by one block from a IStripesActivator (usually a stripes transport pipe) with the pipe supplied * by the stack by moving the stripes pipe to the front and placing the new transport pipe behind. - * If the pipe is a registered retraction pipe (per default only the void transport pipe is - register one with {@link #registerRetractionPipe(PipeDefinition)}) it retracts the pipeline instead by moving the stripes pipe one core + * If the pipe is a registered retraction pipe (per default only the void transport pipe is - register one with {@link #registerRetractionPipe(PipeDefinition)}) it retracts the pipeline instead by moving the stripes pipe one block * in the opposite direction, replacing the previous transport pipe. * * @param world the world diff --git a/api/buildcraft/api/transport/pipe/IPipeHolder.java b/api/buildcraft/api/transport/pipe/IPipeHolder.java index 65fef67..e1bfb46 100644 --- a/api/buildcraft/api/transport/pipe/IPipeHolder.java +++ b/api/buildcraft/api/transport/pipe/IPipeHolder.java @@ -1,14 +1,14 @@ package buildcraft.api.transport.pipe; import buildcraft.api.statements.containers.IRedstoneStatementContainer; +import buildcraft.api.tiles.IBCTileMenuProvider; +import buildcraft.api.tiles.ITickable; import buildcraft.api.transport.IWireManager; import buildcraft.api.transport.pluggable.PipePluggable; -import buildcraft.lib.net.MessageUpdateTile; import com.mojang.authlib.GameProfile; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; @@ -17,10 +17,8 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** - * Designates a tile that can contain a pipe, up to 6 sided pluggables. - */ -public interface IPipeHolder extends IRedstoneStatementContainer, MenuProvider { +/** Designates a tile that can contain a pipe, up to 6 sided pluggables. */ +public interface IPipeHolder extends IRedstoneStatementContainer, IBCTileMenuProvider, ITickable { Level getPipeWorld(); BlockPos getPipePos(); @@ -29,10 +27,8 @@ public interface IPipeHolder extends IRedstoneStatementContainer, MenuProvider { IPipe getPipe(); - /** - * @return true if the player should be able to interact with the pipe holder in GUI form. Implementors should - * generally check to ensure they are still present in-world. - */ + /** @return true if the player should be able to interact with the pipe holder in GUI form. Implementors should + * generally check to ensure they are still present in-world. */ boolean canPlayerInteract(Player player); @Nullable @@ -44,73 +40,44 @@ public interface IPipeHolder extends IRedstoneStatementContainer, MenuProvider { @Nullable IPipe getNeighbourPipe(Direction side); - /** - * Gets the given capability going outwards from the pipe. This will test the - * {@link PipePluggable#getInternalCapability(Capability)} first, and the look at the neighbouring tile. - */ + /** Gets the given capability going outwards from the pipe. This will test the + * {@link PipePluggable#getInternalCapability(Capability)} first, and the look at the neighbouring tile. */ @Nullable T getCapabilityFromPipe(Direction side, @Nonnull Capability capability); -// // Calen test for power flow circle -// @Nullable -// default T getCapabilityFromPipe(Direction side, @Nonnull Capability capability, LinkedList trackList) -// { -// if (trackList.contains(this)) -// { -// return null; -// } -// else -// { -// trackList.push(this); -// T cap = getCapabilityFromPipe(side, capability); -// trackList.pop(); -// return cap; -// } -// } - IWireManager getWireManager(); GameProfile getOwner(); - /** - * @return True if at least 1 handler received this event, false if not. - */ + /** @return True if at least 1 handler received this event, false if not. */ boolean fireEvent(PipeEvent event); void scheduleRenderUpdate(); - /** - * @param parts The parts that want to send a network update. - */ + /** @param parts The parts that want to send a network update. */ void scheduleNetworkUpdate(PipeMessageReceiver... parts); - /** - * Schedules a GUI network update, that is only the players who currently have a pipe element open in a GUI will be + /** Schedules a GUI network update, that is only the players who currently have a pipe element open in a GUI will be * updated. * - * @param parts The parts that want to send a network update. - */ + * @param parts The parts that want to send a network update. */ void scheduleNetworkGuiUpdate(PipeMessageReceiver... parts); - /** - * Sends a custom message from a pluggable or pipe centre to the server/client (depending on which side this is - * currently on). - */ + /** Sends a custom message from a pluggable or pipe centre to the server/client (depending on which side this is + * currently on). */ void sendMessage(PipeMessageReceiver to, IWriter writer); void sendGuiMessage(PipeMessageReceiver to, IWriter writer); - /** - * Called on the server whenever a gui container object is opened. - */ + /** Called on the server whenever a gui container object is opened. */ void onPlayerOpen(Player player); - // Calen: only for Server preparing for opening Gate GUI - MessageUpdateTile onServerPlayerOpenNoSend(Player player); + @Override + default void update() { + ITickable.super.update(); + } - /** - * Called on the server whenever a gui container object is closed. - */ + /** Called on the server whenever a gui container object is closed. */ void onPlayerClose(Player player); enum PipeMessageReceiver { diff --git a/api/buildcraft/api/transport/pipe/IPipeRegistry.java b/api/buildcraft/api/transport/pipe/IPipeRegistry.java index 02aa579..3b7dbc0 100644 --- a/api/buildcraft/api/transport/pipe/IPipeRegistry.java +++ b/api/buildcraft/api/transport/pipe/IPipeRegistry.java @@ -11,29 +11,22 @@ public interface IPipeRegistry { void registerPipe(PipeDefinition definition); - /** - * Maps the given {@link PipeDefinition} to an {@link IItemPipe}. This acts exactly akin to - * {@link Map#put(Object, Object)}. - */ + /** Maps the given {@link PipeDefinition} to an {@link IItemPipe}. This acts exactly akin to + * {@link Map#put(Object, Object)}. */ // void setItemForPipe(PipeDefinition definition, @Nullable IItemPipe item); -// void setItemForPipe(PipeDefinition definition, @Nullable RegistryObject item); void setItemForPipe(PipeDefinition definition, Map> item); - // Calen: reg different item object for different colour - // IItemPipe getItemForPipe(PipeDefinition definition); + /** Creates a pipe item with a single colour */ + // IItemPipe getItemForPipe(PipeDefinition definition); IItemPipe getItemForPipe(PipeDefinition definition, DyeColor colour); - /** - * Creates an {@link IItemPipe} for the given {@link PipeDefinition}. If the {@link PipeDefinition} has been + /** Creates an {@link IItemPipe} for the given {@link PipeDefinition}. If the {@link PipeDefinition} has been * registered with {@link #registerPipe(PipeDefinition)} then it will also be registered with - * {@link #setItemForPipe(PipeDefinition, IItemPipe)}. The returned item will be automatically registered with - * forge. - */ + * {@link #setItemForPipe(PipeDefinition, Map)}. The returned item will be automatically registered with + * forge. */ // IItemPipe createItemForPipe(PipeDefinition definition); -// RegistryObject createItemForPipe(PipeDefinition definition); Map> createItemForPipe(PipeDefinition definition); - // Calen: never used in 1.12.2 // /** Identical to {@link #createItemForPipe(PipeDefinition)}, but doesn't require registering tags with buildcraftcore // * lib in order to register. // * diff --git a/api/buildcraft/api/transport/pipe/PipeApi.java b/api/buildcraft/api/transport/pipe/PipeApi.java index 73d1319..2ea5ade 100644 --- a/api/buildcraft/api/transport/pipe/PipeApi.java +++ b/api/buildcraft/api/transport/pipe/PipeApi.java @@ -5,7 +5,6 @@ import buildcraft.api.transport.IStripesRegistry; import buildcraft.api.transport.pluggable.IPluggableRegistry; import buildcraft.api.transport.pluggable.PipePluggable; -import buildcraft.lib.BCLib; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.CapabilityToken; @@ -18,7 +17,7 @@ import java.util.Map; /** The central holding class for all pipe related registers and methods. */ -@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = BCLib.MODID) // Calen add for reg caps +@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = "buildcraftcore") public final class PipeApi { public static IPipeRegistry pipeRegistry; public static IPluggableRegistry pluggableRegistry; @@ -60,8 +59,7 @@ public static FluidTransferInfo getFluidTransferInfo(PipeDefinition def) { FluidTransferInfo info = fluidTransferData.get(def); if (info == null) { return fluidInfoDefault; - } - else { + } else { return info; } } @@ -70,8 +68,7 @@ public static PowerTransferInfo getPowerTransferInfo(PipeDefinition def) { PowerTransferInfo info = powerTransferData.get(def); if (info == null) { return powerInfoDefault; - } - else { + } else { return info; } } @@ -133,14 +130,6 @@ public PowerTransferInfo(long transferPerTick, long lossPerTick, long resistance // Internals -// static { -// CAP_PIPE = CapabilitiesHelper.registerCapability(IPipe.class); -// CAP_PLUG = CapabilitiesHelper.registerCapability(PipePluggable.class); -// CAP_PIPE_HOLDER = CapabilitiesHelper.registerCapability(IPipeHolder.class); -// CAP_INJECTABLE = CapabilitiesHelper.registerCapability(IInjectable.class); -// } - - // Calen @SubscribeEvent public static void registerCapability(RegisterCapabilitiesEvent event) { event.register(IPipe.class); diff --git a/api/buildcraft/api/transport/pipe/PipeApiClient.java b/api/buildcraft/api/transport/pipe/PipeApiClient.java index b1d78d9..461c2da 100644 --- a/api/buildcraft/api/transport/pipe/PipeApiClient.java +++ b/api/buildcraft/api/transport/pipe/PipeApiClient.java @@ -21,12 +21,10 @@ public interface IClientRegistry { /** Registers a dynamic renderer for the given pipe behaviour. Most {@link PipeBehaviour} types will have no use * for this. */ - void registerRenderer(Class behaviourClass, - IPipeBehaviourRenderer renderer); + void registerRenderer(Class behaviourClass, IPipeBehaviourRenderer renderer);

    void registerRenderer(Class plugClass, IPlugDynamicRenderer

    renderer); -

    void registerBaker(Class keyClass, - IPluggableStaticBaker

    renderer); +

    void registerBaker(Class keyClass, IPluggableStaticBaker

    renderer); } } diff --git a/api/buildcraft/api/transport/pipe/PipeBehaviour.java b/api/buildcraft/api/transport/pipe/PipeBehaviour.java index dfa76b1..bba3609 100644 --- a/api/buildcraft/api/transport/pipe/PipeBehaviour.java +++ b/api/buildcraft/api/transport/pipe/PipeBehaviour.java @@ -40,7 +40,7 @@ public CompoundTag writeToNbt() { public void writePayload(FriendlyByteBuf buffer, Dist side) { } - // public void readPayload(FriendlyByteBuf buffer, Dist side, MessageContext ctx) throws IOException {} + // public void readPayload(FriendlyByteBuf buffer, Dist side, MessageContext ctx) throws IOException {} public void readPayload(FriendlyByteBuf buffer, NetworkDirection side, NetworkEvent.Context ctx) throws IOException { } @@ -69,8 +69,7 @@ public boolean shouldForceConnection(Direction face, BlockEntity oTile) { return false; } - public boolean onPipeActivate(Player player, HitResult trace, float hitX, float hitY, float hitZ, - EnumPipePart part) { + public boolean onPipeActivate(Player player, HitResult trace, float hitX, float hitY, float hitZ, EnumPipePart part) { return false; } @@ -80,10 +79,9 @@ public void onEntityCollide(Entity entity) { public void onTick() { } - // Calen: getCapability(...).isPresent() + // 1.18.2: getCapability().isPresent() // @Override -// public boolean hasCapability(@Nonnull Capability capability, Direction facing) -// { +// public boolean hasCapability(@Nonnull Capability capability, EnumFacing facing) { // return getCapability(capability, facing) != null; // } diff --git a/api/buildcraft/api/transport/pipe/PipeConnectionAPI.java b/api/buildcraft/api/transport/pipe/PipeConnectionAPI.java index 28277d1..b038090 100644 --- a/api/buildcraft/api/transport/pipe/PipeConnectionAPI.java +++ b/api/buildcraft/api/transport/pipe/PipeConnectionAPI.java @@ -5,29 +5,29 @@ import java.util.Map; -/** Use this class to register blocks with custom core sizes so that pipes can connect to them properly. Note that you - * do not need to register a custom pipe connection if your core implements ICustomPipeConnection. The registered +/** Use this class to register blocks with custom block sizes so that pipes can connect to them properly. Note that you + * do not need to register a custom pipe connection if your block implements ICustomPipeConnection. The registered * version does not override your own implementation. */ public final class PipeConnectionAPI { private static final Map connections = Maps.newHashMap(); private static final ICustomPipeConnection NOTHING = (world, pos, face, state) -> 0; - /** Register a core with a custom connection. Useful if you don't own the core class or are adding it for some-one + /** Register a block with a custom connection. Useful if you don't own the block class or are adding it for some-one * else. * - * @param block The core instance + * @param block The block instance * @param connection The connection instance */ public static void registerConnection(Block block, ICustomPipeConnection connection) { connections.put(block, connection); } - /** Ensures that a particular core will always have the default connection, no matter what the bounding box the the - * core is. */ + /** Ensures that a particular block will always have the default connection, no matter what the bounding box the the + * block is. */ public static void registerConnectionAsNothing(Block block) { connections.put(block, NOTHING); } - /** Gets the current custom connection that the core uses. Will be null if nothing has been set. */ + /** Gets the current custom connection that the block uses. Will be null if nothing has been set. */ public static ICustomPipeConnection getCustomConnection(Block block) { if (block instanceof ICustomPipeConnection) { return (ICustomPipeConnection) block; diff --git a/api/buildcraft/api/transport/pipe/PipeDefinition.java b/api/buildcraft/api/transport/pipe/PipeDefinition.java index b5b2c4a..f991d1e 100644 --- a/api/buildcraft/api/transport/pipe/PipeDefinition.java +++ b/api/buildcraft/api/transport/pipe/PipeDefinition.java @@ -73,12 +73,10 @@ public static class PipeDefinitionBuilder { public Item.Properties properties = new Item.Properties() .rarity(Rarity.COMMON) .durability(0) - .stacksTo(64) -// .tab(BCCreativeTab.BC_PIPES_TAB) - ; + .stacksTo(64); public ResourceLocation identifier; public String texturePrefix; - public String[] textureSuffixes = {""}; + public String[] textureSuffixes = { "" }; public IPipeCreator logicConstructor; public IPipeLoader logicLoader; public PipeFlowType flowType; @@ -150,9 +148,8 @@ public PipeDefinitionBuilder texPrefixDirect(String prefix) { * @return this. */ public PipeDefinitionBuilder texSuffixes(String... suffixes) { if (suffixes == null || suffixes.length == 0) { - textureSuffixes = new String[]{""}; - } - else { + textureSuffixes = new String[] { "" }; + } else { textureSuffixes = suffixes; } return this; diff --git a/api/buildcraft/api/transport/pipe/PipeEventFluid.java b/api/buildcraft/api/transport/pipe/PipeEventFluid.java index 3e74bfe..adb3194 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventFluid.java +++ b/api/buildcraft/api/transport/pipe/PipeEventFluid.java @@ -160,8 +160,7 @@ public void disallowAllExcept(Direction side) { if (allowed.contains(side)) { allowed.clear(); allowed.add(side); - } - else { + } else { allowed.clear(); } } diff --git a/api/buildcraft/api/transport/pipe/PipeEventItem.java b/api/buildcraft/api/transport/pipe/PipeEventItem.java index 9f7562b..f861814 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventItem.java +++ b/api/buildcraft/api/transport/pipe/PipeEventItem.java @@ -81,8 +81,7 @@ public ItemStack getStack() { public void setStack(ItemStack stack) { if (stack == null) { throw new NullPointerException("stack"); - } - else { + } else { this.stack = stack; } } @@ -150,8 +149,7 @@ public ItemStack getExcess() { public void setExcess(ItemStack stack) { if (stack == null) { throw new NullPointerException("stack"); - } - else { + } else { this.excess = stack; } } @@ -331,11 +329,9 @@ public ItemStack getStack() { public void setStack(ItemStack stack) { if (stack == null) { throw new NullPointerException("stack"); - } - else if (stack.isEmpty()) { + } else if (stack.isEmpty()) { entity.setItem(ItemStack.EMPTY); - } - else { + } else { entity.setItem(stack); } } diff --git a/api/buildcraft/api/transport/pipe/PipeFaceTex.java b/api/buildcraft/api/transport/pipe/PipeFaceTex.java index b912510..af557ae 100644 --- a/api/buildcraft/api/transport/pipe/PipeFaceTex.java +++ b/api/buildcraft/api/transport/pipe/PipeFaceTex.java @@ -62,12 +62,10 @@ private PipeFaceTex(int[] textures, int... colours) { } if (textures.length == 0) { hash = -1; - } - else if (textures.length == 1) { + } else if (textures.length == 1) { // If the colour is -1 then this will equal the hash below hash = textures[0] + getColour(0) + 1; - } - else { + } else { int[] cArr = colours; { int prevLength = cArr.length; @@ -88,7 +86,7 @@ private PipeFaceTex(int... textures) { } private PipeFaceTex(int singleTexture) { - textures = new int[]{singleTexture}; + textures = new int[] { singleTexture }; colours = EMPTY_INT_ARRAY; hash = singleTexture; } diff --git a/api/buildcraft/api/transport/pipe/PipeFlow.java b/api/buildcraft/api/transport/pipe/PipeFlow.java index 24f90d3..12222d8 100644 --- a/api/buildcraft/api/transport/pipe/PipeFlow.java +++ b/api/buildcraft/api/transport/pipe/PipeFlow.java @@ -21,13 +21,9 @@ import java.io.IOException; public abstract class PipeFlow implements ICapabilityProvider { - /** - * The ID for completely refreshing the state of this flow. - */ + /** The ID for completely refreshing the state of this flow. */ public static final int NET_ID_FULL_STATE = 0; - /** - * The ID for updating what has changed since the last NET_ID_FULL_STATE or NET_ID_UPDATE has been sent. - */ + /** The ID for updating what has changed since the last NET_ID_FULL_STATE or NET_ID_UPDATE has been sent. */ // Wait, what? How is that a good idea or even sensible to make updates work this way? public static final int NET_ID_UPDATE = 1; @@ -45,15 +41,11 @@ public CompoundTag writeToNbt() { return new CompoundTag(); } - /** - * Writes a payload with the specified id. Standard ID's are NET_ID_FULL_STATE and NET_ID_UPDATE. - */ + /** Writes a payload with the specified id. Standard ID's are NET_ID_FULL_STATE and NET_ID_UPDATE. */ public void writePayload(int id, FriendlyByteBuf buffer, Dist side) { } - /** - * Reads a payload with the specified id. Standard ID's are NET_ID_FULL_STATE and NET_ID_UPDATE. - */ + /** Reads a payload with the specified id. Standard ID's are NET_ID_FULL_STATE and NET_ID_UPDATE. */ public void readPayload(int id, FriendlyByteBuf buffer, NetworkDirection side) throws IOException { } @@ -75,10 +67,8 @@ public final void sendCustomPayload(int id, IWriter writer) { public abstract boolean canConnect(Direction face, BlockEntity oTile); - /** - * Used to force a connection to a given tile, even if the {@link PipeBehaviour} wouldn't normally connect to - * it. - */ + /** Used to force a connection to a given tile, even if the {@link PipeBehaviour} wouldn't normally connect to + * it. */ public boolean shouldForceConnection(Direction face, BlockEntity oTile) { return false; } @@ -95,10 +85,8 @@ public boolean onFlowActivate(Player player, HitResult trace, float hitX, float } // @Override -// public final boolean hasCapability(@Nonnull Capability capability, Direction facing) -// { -//// return getCapability(capability, facing) != null; -// return getCapability(capability, facing).isPresent(); +// public final boolean hasCapability(@Nonnull Capability capability, EnumFacing facing) { +// return getCapability(capability, facing) != null; // } @Override diff --git a/api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java b/api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java index 82f963b..5ae33c5 100644 --- a/api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java +++ b/api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java @@ -1,10 +1,9 @@ package buildcraft.api.transport.pluggable; - import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; public interface IPlugDynamicRenderer

    { - // void render(P plug, double x, double y, double z, float partialTicks, VertexConsumer bb); + // void render(P plug, double x, double y, double z, float partialTicks, BufferBuilder bb); void render(P gate, float partialTicks, PoseStack poseStack, VertexConsumer vertexConsumer, int combinedLight, int combinedOverlay); } diff --git a/api/buildcraft/api/transport/pluggable/PipePluggable.java b/api/buildcraft/api/transport/pluggable/PipePluggable.java index 49e3d7c..62e3e1e 100644 --- a/api/buildcraft/api/transport/pluggable/PipePluggable.java +++ b/api/buildcraft/api/transport/pluggable/PipePluggable.java @@ -10,6 +10,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; @@ -43,11 +44,9 @@ public CompoundTag writeToNbt() { return nbt; } - /** - * Writes the payload that will be passed into + /** Writes the payload that will be passed into * {@link PluggableDefinition#loadFromBuffer(IPipeHolder, Direction, FriendlyByteBuf)} on the client. (This is called - * on the server and sent to the client). Note that this will be called *instead* of write and read payload. - */ + * on the server and sent to the client). Note that this will be called *instead* of write and read payload. */ public void writeCreationPayload(FriendlyByteBuf buffer) { } @@ -67,47 +66,35 @@ public final void scheduleNetworkUpdate() { public void onTick() { } - /** - * @return A bounding box that will be used for collisions and raytracing. - */ + /** @return A bounding box that will be used for collisions and raytracing. */ public abstract VoxelShape getBoundingBox(); - /** - * @return True if the pipe cannot connect outwards (it is blocked), or False if this does not core the pipe. - */ + /** @return True if the pipe cannot connect outwards (it is blocked), or False if this does not block the pipe. */ public boolean isBlocking() { return false; } - /** - * Gets the value of a specified capability key, or null if the given capability is not supported at the call time. + /** Gets the value of a specified capability key, or null if the given capability is not supported at the call time. * This is effectively {@link ICapabilityProvider}, but where - * {@link ICapabilityProvider#hasCapability(Capability, Direction)} will return true when this returns a non-null - * value. - */ + * {@link ICapabilityProvider#getCapability(Capability, Direction)#isPresent()} will return true when this returns a non-null + * value. */ public LazyOptional getCapability(@Nonnull Capability cap) { return LazyOptional.empty(); } - /** - * Gets the {@link Capability} that is accessible from the pipe that this is attached to. + /** Gets the {@link Capability} that is accessible from the pipe that this is attached to. * * @param cap - * @return - */ + * @return */ public T getInternalCapability(@Nonnull Capability cap) { return null; } - /** - * Called whenever this pluggable is removed from the pipe. - */ + /** Called whenever this pluggable is removed from the pipe. */ public void onRemove() { } - /** - * @param toDrop A list containing all the items to drop (so you should add your items to this list) - */ + /** @param toDrop A list containing all the items to drop (so you should add your items to this list) */ public void addDrops(NonNullList toDrop, int fortune) { ItemStack stack = getPickStack(); if (!stack.isEmpty()) { @@ -115,11 +102,9 @@ public void addDrops(NonNullList toDrop, int fortune) { } } - /** - * Called whenever this pluggable is picked by the player (similar to Block.getPickBlock) + /** Called whenever this pluggable is picked by the player (similar to Block.getPickBlock) * - * @return The stack that should be picked, or ItemStack.EMPTY if no stack can be picked from this pluggable. - */ + * @return The stack that should be picked, or ItemStack.EMPTY if no stack can be picked from this pluggable. */ public ItemStack getPickStack() { return ItemStack.EMPTY; } @@ -134,36 +119,28 @@ public PluggableModelKey getModelRenderKey(RenderType layer) { return null; } - /** - * Called if the {@link IPluggableStaticBaker} returns quads with tint indexes set to + /** Called if the {@link IPluggableStaticBaker} returns quads with tint indexes set to * data * 6 + key.side.ordinal(). "data" is passed in here as "tintIndex". * - * @return The tint index to render the quad with, or -1 for default. - */ + * @return The tint index to render the quad with, or -1 for default. */ @OnlyIn(Dist.CLIENT) public int getBlockColor(int tintIndex) { return -1; } - /** - * PipePluggable version of - * {@link Block#canBeConnectedTo(net.minecraft.world.level.LevelAccessor, BlockPos, Direction)}. - */ + /** PipePluggable version of + * {@link Block#canBeConnectedTo(net.minecraft.world.level.LevelAccessor, BlockPos, Direction)}. */ public boolean canBeConnected() { return false; } - /** - * PipePluggable version of - * {@link BlockState#isSideSolid(IBlockAccess, BlockPos, Direction)} - */ + /** PipePluggable version of + * {@link BlockState#isSideSolid(IBlockAccess, BlockPos, Direction)} */ public boolean isSideSolid() { return false; } - /** - * PipePluggable version of {@link Block#getExplosionResistance(Level, BlockPos, Entity, Explosion)} - */ + /** PipePluggable version of {@link Block#getExplosionResistance(BlockState, BlockGetter, BlockPos, Explosion)} */ // public float getExplosionResistance(@Nullable Entity exploder, Explosion explosion) public float getExplosionResistance(@Nonnull Entity exploder, Explosion explosion) { return 0; @@ -174,15 +151,10 @@ public boolean canConnectToRedstone(@Nullable Direction to) { } // Calen: seems use block Shape in 1.18.2 -// /** -// * PipePluggable version of -// * {@link net.minecraft.core.state.BlockState#getBlockFaceShape(LevelAccessor, BlockPos, Direction)} -// */ -// public BlockFaceShape getBlockFaceShape() -// public SupportType getBlockFaceShape() -// { -//// return BlockFaceShape.UNDEFINED; -// return SupportType.FULL; +// /** PipePluggable version of +// * {@link net.minecraft.block.state.IBlockState#getBlockFaceShape(IBlockAccess, BlockPos, EnumFacing)} */ +// public BlockFaceShape getBlockFaceShape() { +// return BlockFaceShape.UNDEFINED; // } public void onPlacedBy(Player player) { diff --git a/api/buildcraft/api/transport/pluggable/PluggableDefinition.java b/api/buildcraft/api/transport/pluggable/PluggableDefinition.java index 5cb5fe8..bed9289 100644 --- a/api/buildcraft/api/transport/pluggable/PluggableDefinition.java +++ b/api/buildcraft/api/transport/pluggable/PluggableDefinition.java @@ -46,27 +46,23 @@ public interface IPluggableNbtReader { /** Reads the pipe pluggable from NBT. Unlike {@link IPluggableNetLoader} (which is allowed to fail and throw an * exception if the wrong data is given) this should make a best effort to read the pluggable from nbt, or fall * back to sensible defaults. */ - PipePluggable readFromNbt(PluggableDefinition definition, IPipeHolder holder, Direction side, - CompoundTag nbt); + PipePluggable readFromNbt(PluggableDefinition definition, IPipeHolder holder, Direction side, CompoundTag nbt); } @FunctionalInterface public interface IPluggableNetLoader { - PipePluggable loadFromBuffer(PluggableDefinition definition, IPipeHolder holder, Direction side, - FriendlyByteBuf buffer) throws InvalidInputDataException; + PipePluggable loadFromBuffer(PluggableDefinition definition, IPipeHolder holder, Direction side, FriendlyByteBuf buffer) throws InvalidInputDataException; } @FunctionalInterface public interface IPluggableCreator extends IPluggableNbtReader, IPluggableNetLoader { @Override - default PipePluggable loadFromBuffer(PluggableDefinition definition, IPipeHolder holder, Direction side, - FriendlyByteBuf buffer) { + default PipePluggable loadFromBuffer(PluggableDefinition definition, IPipeHolder holder, Direction side, FriendlyByteBuf buffer) { return createSimplePluggable(definition, holder, side); } @Override - default PipePluggable readFromNbt(PluggableDefinition definition, IPipeHolder holder, Direction side, - CompoundTag nbt) { + default PipePluggable readFromNbt(PluggableDefinition definition, IPipeHolder holder, Direction side, CompoundTag nbt) { return createSimplePluggable(definition, holder, side); } From daf3fc00ad8b46fd1f3f3d446dd0ed2d3a5105c2 Mon Sep 17 00:00:00 2001 From: LRW-Calen Date: Tue, 7 May 2024 18:46:48 +0800 Subject: [PATCH 08/20] A few updates --- api/buildcraft/api/BCItems.java | 1 + api/buildcraft/api/mj/MjAPI.java | 2 -- api/buildcraft/api/tiles/TilesAPI.java | 1 - api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java | 2 +- api/buildcraft/api/transport/pipe/PipeApi.java | 1 - 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/api/buildcraft/api/BCItems.java b/api/buildcraft/api/BCItems.java index fcddd54..3cd6c26 100644 --- a/api/buildcraft/api/BCItems.java +++ b/api/buildcraft/api/BCItems.java @@ -72,6 +72,7 @@ public static class Silicon { public static final Item CHIPSET_DIAMOND = null; public static final Item PLUG_PULSAR = null; + public static final Item PLUG_FACADE = null; } @ObjectHolder("buildcraftrobotics") diff --git a/api/buildcraft/api/mj/MjAPI.java b/api/buildcraft/api/mj/MjAPI.java index 2271188..282f0cb 100644 --- a/api/buildcraft/api/mj/MjAPI.java +++ b/api/buildcraft/api/mj/MjAPI.java @@ -8,12 +8,10 @@ import net.minecraftforge.common.capabilities.CapabilityToken; import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; import javax.annotation.Nonnull; import java.text.DecimalFormat; -@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = "buildcraftcore") public class MjAPI { // ################################ diff --git a/api/buildcraft/api/tiles/TilesAPI.java b/api/buildcraft/api/tiles/TilesAPI.java index 3692ce4..816e822 100644 --- a/api/buildcraft/api/tiles/TilesAPI.java +++ b/api/buildcraft/api/tiles/TilesAPI.java @@ -9,7 +9,6 @@ import javax.annotation.Nonnull; -@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = "buildcraftcore") public class TilesAPI { @Nonnull public static final Capability CAP_CONTROLLABLE = CapabilityManager.get(new CapabilityToken<>() { diff --git a/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java b/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java index 81660a1..f420c9b 100644 --- a/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java +++ b/api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java @@ -7,6 +7,6 @@ @OnlyIn(Dist.CLIENT) public interface IPipeBehaviourRenderer { - // void render(B behaviour, double x, double y, double z, float partialTicks, BufferBuilder bb); + // void render(B behaviour, double x, double y, double z, float partialTicks, BufferBuilder bb); public void render(B gate, float partialTicks, PoseStack poseStack, VertexConsumer vertexConsumer, int combinedLight, int combinedOverlay); } diff --git a/api/buildcraft/api/transport/pipe/PipeApi.java b/api/buildcraft/api/transport/pipe/PipeApi.java index 2ea5ade..e2fdfea 100644 --- a/api/buildcraft/api/transport/pipe/PipeApi.java +++ b/api/buildcraft/api/transport/pipe/PipeApi.java @@ -17,7 +17,6 @@ import java.util.Map; /** The central holding class for all pipe related registers and methods. */ -@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = "buildcraftcore") public final class PipeApi { public static IPipeRegistry pipeRegistry; public static IPluggableRegistry pluggableRegistry; From e685575a548f4c9f5bb36273bef05d5bf86f4509 Mon Sep 17 00:00:00 2001 From: LRW-Calen Date: Wed, 15 May 2024 01:02:47 +0800 Subject: [PATCH 09/20] Fixed getting chipset item --- api/buildcraft/api/enums/EnumRedstoneChipset.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/buildcraft/api/enums/EnumRedstoneChipset.java b/api/buildcraft/api/enums/EnumRedstoneChipset.java index f7c5e7d..1cebdfa 100644 --- a/api/buildcraft/api/enums/EnumRedstoneChipset.java +++ b/api/buildcraft/api/enums/EnumRedstoneChipset.java @@ -29,7 +29,7 @@ public ItemStack getStack(int stackSize) { if (chipset == null) { return ItemStack.EMPTY; } else { - return new ItemStack(BCItems.Silicon.CHIPSET_GOLD, stackSize); + return new ItemStack(chipset, stackSize); } } From 9efe5972161da7c7726519bbe033c0f395d18a47 Mon Sep 17 00:00:00 2001 From: LRW-Calen Date: Wed, 15 May 2024 23:00:21 +0800 Subject: [PATCH 10/20] Some updates --- api/buildcraft/api/tiles/TilesAPI.java | 1 - api/buildcraft/api/transport/pipe/PipeApi.java | 1 - 2 files changed, 2 deletions(-) diff --git a/api/buildcraft/api/tiles/TilesAPI.java b/api/buildcraft/api/tiles/TilesAPI.java index 816e822..9c09125 100644 --- a/api/buildcraft/api/tiles/TilesAPI.java +++ b/api/buildcraft/api/tiles/TilesAPI.java @@ -5,7 +5,6 @@ import net.minecraftforge.common.capabilities.CapabilityToken; import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; import javax.annotation.Nonnull; diff --git a/api/buildcraft/api/transport/pipe/PipeApi.java b/api/buildcraft/api/transport/pipe/PipeApi.java index e2fdfea..904d2c1 100644 --- a/api/buildcraft/api/transport/pipe/PipeApi.java +++ b/api/buildcraft/api/transport/pipe/PipeApi.java @@ -10,7 +10,6 @@ import net.minecraftforge.common.capabilities.CapabilityToken; import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; import javax.annotation.Nonnull; import java.util.IdentityHashMap; From 1bfc132f7a014ef2ed8c64722d5dd6ad19127ac2 Mon Sep 17 00:00:00 2001 From: CalenXwX Date: Sun, 13 Oct 2024 15:25:05 +0800 Subject: [PATCH 11/20] Fix: license --- api/buildcraft/api/core/BuildCraftAPI.java | 4 ++-- api/buildcraft/api/core/IFakePlayerProvider.java | 10 ++++++---- api/buildcraft/api/fuels/ICoolant.java | 4 ++++ api/buildcraft/api/fuels/IFluidCoolant.java | 4 ++-- api/buildcraft/api/fuels/IFuel.java | 4 ++-- api/buildcraft/api/fuels/IFuelManager.java | 4 ++-- api/buildcraft/api/fuels/ISolidCoolant.java | 4 ++-- 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/api/buildcraft/api/core/BuildCraftAPI.java b/api/buildcraft/api/core/BuildCraftAPI.java index 3081f26..352a213 100644 --- a/api/buildcraft/api/core/BuildCraftAPI.java +++ b/api/buildcraft/api/core/BuildCraftAPI.java @@ -1,7 +1,7 @@ /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; import com.google.common.collect.Maps; diff --git a/api/buildcraft/api/core/IFakePlayerProvider.java b/api/buildcraft/api/core/IFakePlayerProvider.java index 8defda3..c5937ec 100755 --- a/api/buildcraft/api/core/IFakePlayerProvider.java +++ b/api/buildcraft/api/core/IFakePlayerProvider.java @@ -1,7 +1,9 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ +/** + * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

    + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. + */ package buildcraft.api.core; import com.mojang.authlib.GameProfile; diff --git a/api/buildcraft/api/fuels/ICoolant.java b/api/buildcraft/api/fuels/ICoolant.java index 464d4dd..1e56403 100644 --- a/api/buildcraft/api/fuels/ICoolant.java +++ b/api/buildcraft/api/fuels/ICoolant.java @@ -1,3 +1,7 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.fuels; import buildcraft.api.BCModules; diff --git a/api/buildcraft/api/fuels/IFluidCoolant.java b/api/buildcraft/api/fuels/IFluidCoolant.java index b0fee8d..44a83af 100644 --- a/api/buildcraft/api/fuels/IFluidCoolant.java +++ b/api/buildcraft/api/fuels/IFluidCoolant.java @@ -1,7 +1,7 @@ /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.fuels; import net.minecraftforge.fluids.FluidStack; diff --git a/api/buildcraft/api/fuels/IFuel.java b/api/buildcraft/api/fuels/IFuel.java index 39d1f0e..3537a1e 100644 --- a/api/buildcraft/api/fuels/IFuel.java +++ b/api/buildcraft/api/fuels/IFuel.java @@ -1,7 +1,7 @@ /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.fuels; import buildcraft.api.BCModules; diff --git a/api/buildcraft/api/fuels/IFuelManager.java b/api/buildcraft/api/fuels/IFuelManager.java index 2666843..e503a61 100644 --- a/api/buildcraft/api/fuels/IFuelManager.java +++ b/api/buildcraft/api/fuels/IFuelManager.java @@ -1,7 +1,7 @@ /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.fuels; import net.minecraft.resources.ResourceLocation; diff --git a/api/buildcraft/api/fuels/ISolidCoolant.java b/api/buildcraft/api/fuels/ISolidCoolant.java index 6de111b..93789f1 100644 --- a/api/buildcraft/api/fuels/ISolidCoolant.java +++ b/api/buildcraft/api/fuels/ISolidCoolant.java @@ -1,7 +1,7 @@ /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.fuels; import net.minecraft.world.item.ItemStack; From 173aeeabcc0e86f6f902228079fa2904c965fabf Mon Sep 17 00:00:00 2001 From: CalenXwX Date: Sun, 13 Oct 2024 15:30:32 +0800 Subject: [PATCH 12/20] Fix: license --- api/buildcraft/api/fuels/ICoolantManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/buildcraft/api/fuels/ICoolantManager.java b/api/buildcraft/api/fuels/ICoolantManager.java index 629c002..928c83e 100644 --- a/api/buildcraft/api/fuels/ICoolantManager.java +++ b/api/buildcraft/api/fuels/ICoolantManager.java @@ -1,7 +1,7 @@ /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.fuels; import net.minecraft.resources.ResourceLocation; From df50239d6b634c16eafafb67fb799221dda62adf Mon Sep 17 00:00:00 2001 From: CalenXwX Date: Tue, 17 Dec 2024 14:20:20 +0800 Subject: [PATCH 13/20] Now gradle build is available --- build.gradle | 122 ++------------------------------ resources/accesstransformer.cfg | 1 + settings.gradle | 0 3 files changed, 5 insertions(+), 118 deletions(-) create mode 100644 resources/accesstransformer.cfg create mode 100644 settings.gradle diff --git a/build.gradle b/build.gradle index efba5d9..03c3955 100644 --- a/build.gradle +++ b/build.gradle @@ -2,15 +2,12 @@ buildscript { repositories { // These repositories are only for Gradle plugins, put any other repositories in the repository core further below maven { url = 'https://maven.minecraftforge.net' } -// maven { url = 'https://maven.parchmentmc.org' } mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true // Mixin - //classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT' classpath 'org.spongepowered:mixingradle:0.7.+' - classpath 'javax.vecmath:vecmath:1.5.2' } } // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. @@ -37,7 +34,7 @@ configFile.withReader { } version = config.mod_version -group= "com.mod-buildcraft.api" +group = "com.mod-buildcraft.api" archivesBaseName = "buildcraft-api" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension] // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. @@ -60,111 +57,8 @@ minecraft { // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: config.mappings_channel, version: config.mappings_version -// mappings channel: 'parchment', version: '2022.08.07-1.18.2' -// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') - accessTransformer = file('buildcraft_resources/META-INF/accesstransformer.cfg') - // Currently, this location cannot be changed from the default. - - // Default run configurations. - // These can be tweaked, removed, or duplicated as needed. - runs { - client { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - property 'forge.logging.markers', 'REGISTRIES' - - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - property 'forge.logging.console.level', 'debug' - - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', 'buildcraftcore,buildcraftenergy,buildcraftfactory,buildcraftlib' - - // Mixin - arg "-mixin.config=mixins.buildcraft.json" - - mods { - buildcraftcore { - source sourceSets.main - } - } - } - - server { - workingDirectory project.file('run') - - property 'forge.logging.markers', 'REGISTRIES' - - property 'forge.logging.console.level', 'debug' - - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', 'buildcraftcore' - - // Mixin - arg "-mixin.config=mixins.buildcraft.json" - - mods { - buildcraftcore { - source sourceSets.main - } - } - } - - // This run config launches GameTestServer and runs all registered gametests, then exits. - // By default, the server will crash when no gametests are provided. - // The gametest system is also enabled by default for other run configs under the /test command. - gameTestServer { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - property 'forge.logging.markers', 'REGISTRIES' - - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - property 'forge.logging.console.level', 'debug' - - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', 'buildcraftcore' - - mods { - buildcraftcore { - source sourceSets.main - } - } - } - - data { - workingDirectory project.file('run') - - property 'forge.logging.markers', 'REGISTRIES' - - property 'forge.logging.console.level', 'debug' - -// property 'forge.enabledGameTestNamespaces', 'buildcraftcore,buildcraftenergy,buildcraftfactory,buildcraftlib' - - // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - args '--mod', 'buildcraftcore', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') - - - mods { - buildcraftcore { - source sourceSets.main - } - } - } - } + accessTransformer = file('resources/accesstransformer.cfg') } // Include resources generated by data generators. @@ -174,6 +68,8 @@ sourceSets { srcDir "api" } } + resources { + } } @@ -195,16 +91,6 @@ repositories { } } -// Mixin -mixin { - add sourceSets.main, "refmap.buildcraft.json" - config 'mixins.buildcraft.json' - mixin.env.remapRefMap = true - debug = true - debug.verbose = true - debug.export = true -} - dependencies { // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. diff --git a/resources/accesstransformer.cfg b/resources/accesstransformer.cfg new file mode 100644 index 0000000..bd20d2e --- /dev/null +++ b/resources/accesstransformer.cfg @@ -0,0 +1 @@ +public net.minecraft.core.Direction f_122349_ # BY_2D_DATA diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..e69de29 From 46b3775a32ff2a04b49247fa19aab22993f45424 Mon Sep 17 00:00:00 2001 From: CalenXwX Date: Tue, 17 Dec 2024 15:21:48 +0800 Subject: [PATCH 14/20] Updated FakeWorld and IPipeFlowRenderer --- api/buildcraft/api/core/IFakeWorld.java | 4 ++-- api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/buildcraft/api/core/IFakeWorld.java b/api/buildcraft/api/core/IFakeWorld.java index 608e33d..597a252 100644 --- a/api/buildcraft/api/core/IFakeWorld.java +++ b/api/buildcraft/api/core/IFakeWorld.java @@ -10,7 +10,7 @@ import java.util.function.Supplier; public abstract class IFakeWorld extends Level { - protected IFakeWorld(WritableLevelData data, ResourceKey dim, Holder dimensionType, Supplier profiler, boolean pIsClientSide, boolean p_204154_, long p_204155_) { - super(data, dim, dimensionType, profiler, pIsClientSide, p_204154_, p_204155_); + protected IFakeWorld(WritableLevelData data, ResourceKey dim, Holder dimensionType, Supplier profiler, boolean pIsClientSide, boolean isDebug, long biomeZoomSeed) { + super(data, dim, dimensionType, profiler, pIsClientSide, isDebug, biomeZoomSeed); } } diff --git a/api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java b/api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java index 34a6a6b..d5021a3 100644 --- a/api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java +++ b/api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java @@ -1,11 +1,11 @@ package buildcraft.api.transport.pipe; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.renderer.MultiBufferSource; public interface IPipeFlowRenderer { /** @param flow The flow to render - * @param bufferBuilder The (optional) vertex buffer that you can render into. Note that you can still do GL stuff. */ + * @param bufferSource The buffer source of (optional) vertex buffer that you can render into. Note that you can still do GL stuff. */ // void render(F flow, double x, double y, double z, float partialTicks, BufferBuilder bufferBuilder); - void render(F flow, float partialTicks, PoseStack poseStack, VertexConsumer bufferBuilder, int combinedLight, int combinedOverlay); + void render(F flow, float partialTicks, PoseStack poseStack, MultiBufferSource bufferSource, int combinedLight, int combinedOverlay); } From 0aa8c816d35dc2a4f8e14b1f2352a970fc3df7b9 Mon Sep 17 00:00:00 2001 From: CalenXwX Date: Sat, 25 Jan 2025 18:14:40 +0800 Subject: [PATCH 15/20] Updated engine type --- api/buildcraft/api/core/IEngineType.java | 3 +-- api/buildcraft/api/enums/EnumEngineType.java | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/api/buildcraft/api/core/IEngineType.java b/api/buildcraft/api/core/IEngineType.java index 3b3750b..d6fc9c3 100644 --- a/api/buildcraft/api/core/IEngineType.java +++ b/api/buildcraft/api/core/IEngineType.java @@ -1,6 +1,5 @@ package buildcraft.api.core; public interface IEngineType { - @Deprecated(forRemoval = true) - String getItemModelLocation(); +// String getItemModelLocation(); } diff --git a/api/buildcraft/api/enums/EnumEngineType.java b/api/buildcraft/api/enums/EnumEngineType.java index b3f6b72..0a86c93 100644 --- a/api/buildcraft/api/enums/EnumEngineType.java +++ b/api/buildcraft/api/enums/EnumEngineType.java @@ -22,11 +22,10 @@ public enum EnumEngineType implements StringRepresentable, IEngineType { resourceLocation = "buildcraft" + mod + ":blocks/engine/inv/" + loc; } - @Deprecated(forRemoval = true) - @Override - public String getItemModelLocation() { - return resourceLocation; - } +// @Override +// public String getItemModelLocation() { +// return resourceLocation; +// } @Override public String getSerializedName() { From db7e646f680266aebdcd266d75347fe567d65269 Mon Sep 17 00:00:00 2001 From: CalenXwX Date: Mon, 21 Apr 2025 10:03:34 +0800 Subject: [PATCH 16/20] Robotics! --- .../api/boards/RedstoneBoardNBT.java | 27 +++++-- .../api/boards/RedstoneBoardRegistry.java | 14 +++- .../api/boards/RedstoneBoardRobotNBT.java | 3 + api/buildcraft/api/core/BuildCraftAPI.java | 36 ++++----- api/buildcraft/api/core/IBlockFilter.java | 13 ++++ api/buildcraft/api/core/IEntityFilter.java | 13 ++++ api/buildcraft/api/core/IInvSlot.java | 6 +- api/buildcraft/api/crops/CropManager.java | 14 +++- api/buildcraft/api/crops/ICropHandler.java | 6 +- api/buildcraft/api/gates/IGateProvider.java | 6 ++ api/buildcraft/api/mj/IMjContainerItem.java | 13 ++++ api/buildcraft/api/mj/MjBattery.java | 6 +- .../api/recipes/BuildcraftRecipeRegistry.java | 1 + .../recipes/IIntegrationRecipeProvider.java | 7 +- .../recipes/IIntegrationRecipeRegistry.java | 5 +- .../api/recipes/IProgrammingRecipe.java | 78 +++++++++++++++++++ .../recipes/IProgrammingRecipeManager.java | 29 +++++++ .../api/recipes/IntegrationRecipe.java | 67 ++++++++++++++-- .../api/registry/EventBuildCraftReload.java | 10 ++- .../api/robots/EntityRobotBase.java | 12 +-- .../api/robots/IRequestProvider.java | 4 + .../api/robots/IRobotOverlayItem.java | 4 +- api/buildcraft/api/robots/IStationFilter.java | 10 +++ .../api/statements/ActionState.java | 10 +++ .../api/statements/IStatementParameter.java | 6 +- .../StatementParameterItemStack.java | 4 +- .../api/transport/IStripesRegistry.java | 8 ++ .../transport/pluggable/ActionIterator.java | 69 ++++++++++++++++ 28 files changed, 415 insertions(+), 66 deletions(-) create mode 100644 api/buildcraft/api/core/IBlockFilter.java create mode 100644 api/buildcraft/api/core/IEntityFilter.java create mode 100644 api/buildcraft/api/gates/IGateProvider.java create mode 100644 api/buildcraft/api/mj/IMjContainerItem.java create mode 100644 api/buildcraft/api/recipes/IProgrammingRecipe.java create mode 100644 api/buildcraft/api/recipes/IProgrammingRecipeManager.java create mode 100644 api/buildcraft/api/robots/IStationFilter.java create mode 100644 api/buildcraft/api/statements/ActionState.java create mode 100644 api/buildcraft/api/transport/pluggable/ActionIterator.java diff --git a/api/buildcraft/api/boards/RedstoneBoardNBT.java b/api/buildcraft/api/boards/RedstoneBoardNBT.java index 1508afa..f8e7739 100755 --- a/api/buildcraft/api/boards/RedstoneBoardNBT.java +++ b/api/buildcraft/api/boards/RedstoneBoardNBT.java @@ -6,9 +6,13 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; -import net.minecraft.world.entity.player.Player; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import javax.annotation.Nullable; import java.util.List; import java.util.Random; @@ -16,19 +20,26 @@ public abstract class RedstoneBoardNBT { private static Random rand = new Random(); - public abstract String getID(); + public abstract ResourceLocation getID(); - public abstract void addInformation(ItemStack stack, Player player, List list, boolean advanced); + // public abstract void addInformation(ItemStack stack, Player player, List list, boolean advanced); + public abstract void addInformation(ItemStack stack, @Nullable Level world, List list, TooltipFlag flag); - public abstract String getDisplayName(); + // public abstract String getDisplayName(); + public final String getDisplayName() { + return getDisplayNameComponent().getString(); + } + + public abstract Component getDisplayNameComponent(); public abstract IRedstoneBoard create(CompoundTag nbt, T object); - public abstract String getItemModelLocation(); + // public abstract String getItemModelLocation(); + public abstract String getBoardTexture(); - public void createBoard(CompoundTag nbt) { - nbt.putString("id", getID()); - } +// public void createBoard(CompoundTag nbt) { +// nbt.putString("id", getID().toString()); +// } public int getParameterNumber(CompoundTag nbt) { if (!nbt.contains("parameters")) { diff --git a/api/buildcraft/api/boards/RedstoneBoardRegistry.java b/api/buildcraft/api/boards/RedstoneBoardRegistry.java index c3b6157..d923ff6 100755 --- a/api/buildcraft/api/boards/RedstoneBoardRegistry.java +++ b/api/buildcraft/api/boards/RedstoneBoardRegistry.java @@ -5,8 +5,12 @@ package buildcraft.api.boards; import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraftforge.registries.RegistryObject; -import java.util.Collection; +import java.util.List; +import java.util.Map; public abstract class RedstoneBoardRegistry { @@ -24,9 +28,13 @@ public abstract class RedstoneBoardRegistry { public abstract RedstoneBoardNBT getRedstoneBoard(CompoundTag nbt); - public abstract RedstoneBoardNBT getRedstoneBoard(String id); + // public abstract RedstoneBoardNBT getRedstoneBoard(String id); + public abstract RedstoneBoardNBT getRedstoneBoard(ResourceLocation id); - public abstract Collection> getAllBoardNBTs(); + // public abstract Collection> getAllBoardNBTs(); + public abstract List> getAllBoardNBTs(); + + public abstract Map, RegistryObject> getBoardNBTItemMap(); public abstract long getPowerCost(RedstoneBoardNBT board); } diff --git a/api/buildcraft/api/boards/RedstoneBoardRobotNBT.java b/api/buildcraft/api/boards/RedstoneBoardRobotNBT.java index cb7debb..9f87bc2 100755 --- a/api/buildcraft/api/boards/RedstoneBoardRobotNBT.java +++ b/api/buildcraft/api/boards/RedstoneBoardRobotNBT.java @@ -18,5 +18,8 @@ public RedstoneBoardRobot create(CompoundTag nbt, EntityRobotBase robot) { public abstract RedstoneBoardRobot create(EntityRobotBase robot); public abstract ResourceLocation getRobotTexture(); + // Calen 1.18.2 + public abstract ResourceLocation getRobotTextureFullLocation(); + public abstract ResourceLocation getRobotId(); } diff --git a/api/buildcraft/api/core/BuildCraftAPI.java b/api/buildcraft/api/core/BuildCraftAPI.java index 352a213..f61f69f 100644 --- a/api/buildcraft/api/core/BuildCraftAPI.java +++ b/api/buildcraft/api/core/BuildCraftAPI.java @@ -4,24 +4,16 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; import net.minecraftforge.fml.ModContainer; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoadingContext; -import java.util.HashMap; -import java.util.Set; - public final class BuildCraftAPI { public static IFakePlayerProvider fakePlayerProvider; - public static final Set softBlocks = Sets.newHashSet(); - public static final HashMap worldProperties = Maps.newHashMap(); + // public static final Set softBlocks = Sets.newHashSet(); + // public static final HashMap worldProperties = Maps.newHashMap(); /** Deactivate constructor */ private BuildCraftAPI() { @@ -35,20 +27,20 @@ public static String getVersion() { return "UNKNOWN VERSION"; } - public static IWorldProperty getWorldProperty(String name) { - return worldProperties.get(name); - } +// public static IWorldProperty getWorldProperty(String name) { +// return worldProperties.get(name); +// } - public static void registerWorldProperty(String name, IWorldProperty property) { - if (worldProperties.containsKey(name)) { - BCLog.logger.warn("The WorldProperty key '" + name + "' is being overridden with " + property.getClass().getSimpleName() + "!"); - } - worldProperties.put(name, property); - } +// public static void registerWorldProperty(String name, IWorldProperty property) { +// if (worldProperties.containsKey(name)) { +// BCLog.logger.warn("The WorldProperty key '" + name + "' is being overridden with " + property.getClass().getSimpleName() + "!"); +// } +// worldProperties.put(name, property); +// } - public static boolean isSoftBlock(Level world, BlockPos pos) { - return worldProperties.get("soft").get(world, pos); - } +// public static boolean isSoftBlock(Level world, BlockPos pos) { +// return worldProperties.get("soft").get(world, pos); +// } public static ResourceLocation nameToResourceLocation(String name) { if (name.indexOf(':') > 0) return new ResourceLocation(name); diff --git a/api/buildcraft/api/core/IBlockFilter.java b/api/buildcraft/api/core/IBlockFilter.java new file mode 100644 index 0000000..f7b3e82 --- /dev/null +++ b/api/buildcraft/api/core/IBlockFilter.java @@ -0,0 +1,13 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

    + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ +package buildcraft.api.core; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; + +// Calen 1.18.2 from 1.8.9 +public interface IBlockFilter { + boolean matches(Level world, BlockPos pos); +} diff --git a/api/buildcraft/api/core/IEntityFilter.java b/api/buildcraft/api/core/IEntityFilter.java new file mode 100644 index 0000000..0c836de --- /dev/null +++ b/api/buildcraft/api/core/IEntityFilter.java @@ -0,0 +1,13 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

    + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ +package buildcraft.api.core; + +import net.minecraft.world.entity.Entity; + +public interface IEntityFilter { + + boolean matches(Entity entity); + +} diff --git a/api/buildcraft/api/core/IInvSlot.java b/api/buildcraft/api/core/IInvSlot.java index d39119a..191fd9f 100644 --- a/api/buildcraft/api/core/IInvSlot.java +++ b/api/buildcraft/api/core/IInvSlot.java @@ -6,6 +6,8 @@ import net.minecraft.world.item.ItemStack; +import javax.annotation.Nonnull; + public interface IInvSlot { /** Returns the slot number of the underlying Inventory. * @@ -18,9 +20,11 @@ public interface IInvSlot { boolean isItemValidForSlot(ItemStack stack); + @Nonnull ItemStack decreaseStackInSlot(int amount); + @Nonnull ItemStack getStackInSlot(); - void setStackInSlot(ItemStack stack); + void setStackInSlot(@Nonnull ItemStack stack); } diff --git a/api/buildcraft/api/crops/CropManager.java b/api/buildcraft/api/crops/CropManager.java index cf439e2..8429dbe 100644 --- a/api/buildcraft/api/crops/CropManager.java +++ b/api/buildcraft/api/crops/CropManager.java @@ -12,6 +12,12 @@ import java.util.List; public final class CropManager { + public enum HarvestResult { + SUCCESS, + FAIL, + PROGRESS; + } + private static List handlers = new ArrayList<>(); private static ICropHandler defaultHandler; @@ -73,13 +79,15 @@ public static boolean isMature(LevelAccessor blockAccess, BlockState state, Bloc return defaultHandler.isMature(blockAccess, state, pos); } - public static boolean harvestCrop(Level world, BlockPos pos, NonNullList drops) { + // public static boolean harvestCrop(Level world, BlockPos pos, NonNullList drops) + public static HarvestResult harvestCrop(Level world, BlockPos pos, ItemStack tool, NonNullList drops) { BlockState state = world.getBlockState(pos); for (ICropHandler cropHandler : handlers) { if (cropHandler.isMature(world, state, pos)) { - return cropHandler.harvestCrop(world, pos, drops); + return cropHandler.harvestCrop(world, pos, tool, drops); } } - return defaultHandler.isMature(world, state, pos) && defaultHandler.harvestCrop(world, pos, drops); + // return defaultHandler.isMature(world, state, pos) && defaultHandler.harvestCrop(world, pos, drops); + return defaultHandler.isMature(world, state, pos) ? defaultHandler.harvestCrop(world, pos, tool, drops) : HarvestResult.FAIL; } } diff --git a/api/buildcraft/api/crops/ICropHandler.java b/api/buildcraft/api/crops/ICropHandler.java index 8d5f426..701abf8 100644 --- a/api/buildcraft/api/crops/ICropHandler.java +++ b/api/buildcraft/api/crops/ICropHandler.java @@ -8,6 +8,8 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; +import javax.annotation.Nonnull; + public interface ICropHandler { /** Check if an item is a seed. @@ -46,8 +48,10 @@ public interface ICropHandler { * * @param world * @param pos + * @param tool * @param drops a list to return the harvest's drops. * @return true if the block was successfully harvested. */ - boolean harvestCrop(Level world, BlockPos pos, NonNullList drops); + // boolean harvestCrop(Level world, BlockPos pos, NonNullList drops); + CropManager.HarvestResult harvestCrop(Level world, BlockPos pos, @Nonnull ItemStack tool, NonNullList drops); } diff --git a/api/buildcraft/api/gates/IGateProvider.java b/api/buildcraft/api/gates/IGateProvider.java new file mode 100644 index 0000000..6e8f3bd --- /dev/null +++ b/api/buildcraft/api/gates/IGateProvider.java @@ -0,0 +1,6 @@ +package buildcraft.api.gates; + +// Calen 1.18.2 +public interface IGateProvider { + IGate getGate(); +} diff --git a/api/buildcraft/api/mj/IMjContainerItem.java b/api/buildcraft/api/mj/IMjContainerItem.java new file mode 100644 index 0000000..aa537a5 --- /dev/null +++ b/api/buildcraft/api/mj/IMjContainerItem.java @@ -0,0 +1,13 @@ +package buildcraft.api.mj; + +import net.minecraft.world.item.ItemStack; + +public interface IMjContainerItem { + long receivePower(ItemStack container, long maxReceive, boolean simulate); + + long extractPower(ItemStack container, long maxExtract, boolean simulate); + + long getPowerStored(ItemStack container); + + long getMaxPowerStored(ItemStack container); +} diff --git a/api/buildcraft/api/mj/MjBattery.java b/api/buildcraft/api/mj/MjBattery.java index 4a1b7fa..b3e3384 100644 --- a/api/buildcraft/api/mj/MjBattery.java +++ b/api/buildcraft/api/mj/MjBattery.java @@ -10,6 +10,8 @@ /** Provides a basic implementation of a simple battery. Note that you should call {@link #tick(Level, BlockPos)} or * {@link #tick(Level, Vec3)} every tick to allow for losing excess power. */ public class MjBattery implements INBTSerializable { + public static final String NBT_STORED = "stored"; + private final long capacity; private long microJoules = 0; @@ -20,13 +22,13 @@ public MjBattery(long capacity) { @Override public CompoundTag serializeNBT() { CompoundTag nbt = new CompoundTag(); - nbt.putLong("stored", microJoules); + nbt.putLong(NBT_STORED, microJoules); return nbt; } @Override public void deserializeNBT(CompoundTag nbt) { - microJoules = nbt.getLong("stored"); + microJoules = nbt.getLong(NBT_STORED); } public void writeToBuffer(ByteBuf buffer) { diff --git a/api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java b/api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java index 6174520..6e6218f 100644 --- a/api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java +++ b/api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java @@ -8,6 +8,7 @@ public final class BuildcraftRecipeRegistry { public static IIntegrationRecipeRegistry integrationRecipes; public static IRefineryRecipeManager refineryRecipes; + public static IProgrammingRecipeManager programmingRecipes; private BuildcraftRecipeRegistry() { } diff --git a/api/buildcraft/api/recipes/IIntegrationRecipeProvider.java b/api/buildcraft/api/recipes/IIntegrationRecipeProvider.java index 0185609..2f4aa08 100644 --- a/api/buildcraft/api/recipes/IIntegrationRecipeProvider.java +++ b/api/buildcraft/api/recipes/IIntegrationRecipeProvider.java @@ -3,6 +3,7 @@ import net.minecraft.core.NonNullList; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -17,10 +18,12 @@ public interface IIntegrationRecipeProvider { * @param toIntegrate A list of stacks to try to integrate to the * @return */ @Nullable - IntegrationRecipe getRecipeFor(@Nonnull ItemStack target, @Nonnull NonNullList toIntegrate); + // IntegrationRecipe getRecipeFor(@Nonnull ItemStack target, @Nonnull NonNullList toIntegrate); + IntegrationRecipe getRecipeFor(@Nonnull ItemStack target, @Nonnull NonNullList toIntegrate, Level world); /** * Returns recipe by it's name */ - IntegrationRecipe getRecipe(@Nonnull ResourceLocation name); + // IntegrationRecipe getRecipe(@Nonnull ResourceLocation name); + IntegrationRecipe getRecipe(@Nonnull ResourceLocation name, Level world); } diff --git a/api/buildcraft/api/recipes/IIntegrationRecipeRegistry.java b/api/buildcraft/api/recipes/IIntegrationRecipeRegistry.java index d4bd8ee..8f94814 100644 --- a/api/buildcraft/api/recipes/IIntegrationRecipeRegistry.java +++ b/api/buildcraft/api/recipes/IIntegrationRecipeRegistry.java @@ -1,5 +1,7 @@ package buildcraft.api.recipes; +import net.minecraft.world.level.Level; + import java.util.Iterator; public interface IIntegrationRecipeRegistry extends IIntegrationRecipeProvider { @@ -9,6 +11,7 @@ public interface IIntegrationRecipeRegistry extends IIntegrationRecipeProvider { * Gets all of the simple recipes that are registered. Note that you *can* use the returned iterator's * {@link Iterator#remove()} method to remove recipes from this registry. */ - Iterable getAllRecipes(); + // Iterable getAllRecipes(); + Iterable getAllRecipes(Level world); } diff --git a/api/buildcraft/api/recipes/IProgrammingRecipe.java b/api/buildcraft/api/recipes/IProgrammingRecipe.java new file mode 100644 index 0000000..af86115 --- /dev/null +++ b/api/buildcraft/api/recipes/IProgrammingRecipe.java @@ -0,0 +1,78 @@ +package buildcraft.api.recipes; + +import buildcraft.api.BCModules; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; + +// public interface IProgrammingRecipe +public interface IProgrammingRecipe extends Recipe { + public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.SILICON.getModId(), "programming"); + + public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); + + @Override + default RecipeType getType() { + return TYPE; + } + + ResourceLocation getId(); + +// /** Get a list (size at least width*height) of ItemStacks representing options. +// * +// * @param width The width of the Programming Table panel. +// * @param height The height of the Programming Table panel. +// * @return */ +// List getOptions(int width, int height); + + /** Get the energy cost of a given option ItemStack. + * + * @return */ + // int getEnergyCost(ItemStack option); + long getEnergyCost(); + + /** @param input The input stack. + * @return Whether this recipe applies to the given input stack. */ + boolean canCraft(ItemStack input); + + /** Craft the input ItemStack with the given option into an output ItemStack. + * + * @param input + * @return The output ItemStack. */ + // ItemStack craft(ItemStack input, ItemStack option); + ItemStack craft(ItemStack input); + + IngredientStack getInput(); + + ItemStack getOutput(); + + // Recipe + + @Override + public default boolean matches(Container inv, Level world) { + return false; + } + + @Override + default ItemStack assemble(Container inv) { + return ItemStack.EMPTY; + } + + @Override + public default boolean canCraftInDimensions(int width, int height) { + return true; + } + + @Override + default ItemStack getResultItem() { + return ItemStack.EMPTY; + } + + @Override + public default boolean isSpecial() { + return true; + } +} diff --git a/api/buildcraft/api/recipes/IProgrammingRecipeManager.java b/api/buildcraft/api/recipes/IProgrammingRecipeManager.java new file mode 100644 index 0000000..360b695 --- /dev/null +++ b/api/buildcraft/api/recipes/IProgrammingRecipeManager.java @@ -0,0 +1,29 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.recipes; + +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; + +import java.util.Collection; +import java.util.List; + +public interface IProgrammingRecipeManager { + void addRecipe(IProgrammingRecipe recipe); + + // void removeRecipe(String id); + void removeRecipe(ResourceLocation id); + + void removeRecipe(IProgrammingRecipe recipe); + + // IProgrammingRecipe getRecipe(String id); + IProgrammingRecipe getRecipe(Level world, ResourceLocation id); + + // Collection getRecipes(); + Collection getRecipes(Level world); + + // Calen 1.18.2 + List getOptions(List recipes, int width, int height); +} diff --git a/api/buildcraft/api/recipes/IntegrationRecipe.java b/api/buildcraft/api/recipes/IntegrationRecipe.java index 7dcc001..3e73c59 100644 --- a/api/buildcraft/api/recipes/IntegrationRecipe.java +++ b/api/buildcraft/api/recipes/IntegrationRecipe.java @@ -1,17 +1,31 @@ package buildcraft.api.recipes; +import buildcraft.api.BCModules; import com.google.common.collect.ImmutableList; import net.minecraft.core.NonNullList; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; import javax.annotation.Nonnull; -public abstract class IntegrationRecipe { +public abstract class IntegrationRecipe implements Recipe { + public static final ResourceLocation TYPE_ID = new ResourceLocation(BCModules.SILICON.getModId(), "integration"); + + public static final RecipeType TYPE = RecipeType.register(TYPE_ID.toString()); + public final ResourceLocation name; - public IntegrationRecipe(ResourceLocation name) { + private final long energyCost; + private final int maxExpansionCount; + + public IntegrationRecipe(ResourceLocation name, long energyCost, int maxExpansionCount) { this.name = name; + this.energyCost = energyCost; + this.maxExpansionCount = maxExpansionCount; } /** @@ -22,22 +36,31 @@ public IntegrationRecipe(ResourceLocation name) { */ public abstract ItemStack getOutput(@Nonnull ItemStack target, NonNullList toIntegrate); + // Calen 1.18.2 + public abstract ItemStack getExampleOutput(); + /** * Determines the components to use when crafting finishes - * @param output The generated outputted, determined by getOutput * @return The components to use up */ - public abstract ImmutableList getRequirements(@Nonnull ItemStack output); + // public abstract ImmutableList getRequirements(@Nonnull ItemStack output); + public abstract ImmutableList getRequirements(); /** * Determines the amount of MJ required to integrate - * @param output The output that would be generated * @return The powercost in microjoules */ - public abstract long getRequiredMicroJoules(ItemStack output); + // public abstract long getRequiredMicroJoules(ItemStack output); + public final long getRequiredMicroJoules() { + return energyCost; + } public abstract IngredientStack getCenterStack(); + public int getMaxExpansionCount() { + return maxExpansionCount; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -56,4 +79,36 @@ public boolean equals(Object o) { public int hashCode() { return name.hashCode(); } + + // Recipe + + @Override + public boolean matches(Container inv, Level world) { + return false; + } + + @Override + public ItemStack assemble(Container inv) { + return ItemStack.EMPTY; + } + + @Override + public boolean canCraftInDimensions(int width, int height) { + return true; + } + + @Override + public ItemStack getResultItem() { + return ItemStack.EMPTY; + } + + @Override + public boolean isSpecial() { + return true; + } + + @Override + public RecipeType getType() { + return TYPE; + } } diff --git a/api/buildcraft/api/registry/EventBuildCraftReload.java b/api/buildcraft/api/registry/EventBuildCraftReload.java index 9cda724..d51d051 100644 --- a/api/buildcraft/api/registry/EventBuildCraftReload.java +++ b/api/buildcraft/api/registry/EventBuildCraftReload.java @@ -5,11 +5,13 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fml.event.IModBusEvent; import javax.annotation.Nullable; import java.util.Set; -public abstract class EventBuildCraftReload extends Event { +// public abstract class EventBuildCraftReload extends Event +public abstract class EventBuildCraftReload extends Event implements IModBusEvent { /** The manager that is being reloaded. */ public final IReloadableRegistryManager manager; @@ -26,7 +28,7 @@ public EventBuildCraftReload(IReloadableRegistryManager manager, Set> reloadingRegistries) { + @Nullable Set> reloadingRegistries) { super(manager, reloadingRegistries); } } @@ -47,7 +49,7 @@ public static class PopulateGson extends EventBuildCraftReload { public final GsonBuilder gsonBuilder; public PopulateGson(IReloadableRegistryManager manager, - @Nullable Set> reloadingRegistries, GsonBuilder gsonBuilder) { + @Nullable Set> reloadingRegistries, GsonBuilder gsonBuilder) { super(manager, reloadingRegistries); this.gsonBuilder = gsonBuilder; } @@ -65,7 +67,7 @@ public PostLoad(IReloadableRegistryManager manager, @Nullable Set> reloadingRegistries) { + @Nullable Set> reloadingRegistries) { super(manager, reloadingRegistries); } } diff --git a/api/buildcraft/api/robots/EntityRobotBase.java b/api/buildcraft/api/robots/EntityRobotBase.java index bc74a98..65403aa 100755 --- a/api/buildcraft/api/robots/EntityRobotBase.java +++ b/api/buildcraft/api/robots/EntityRobotBase.java @@ -5,7 +5,6 @@ package buildcraft.api.robots; import buildcraft.api.boards.RedstoneBoardRobot; -import buildcraft.api.core.IFluidHandlerAdv; import buildcraft.api.core.IZone; import buildcraft.api.mj.MjAPI; import buildcraft.api.mj.MjBattery; @@ -16,20 +15,21 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraftforge.items.IItemHandler; -public abstract class EntityRobotBase extends LivingEntity implements IItemHandler, IFluidHandlerAdv { +import javax.annotation.Nonnull; + +public abstract class EntityRobotBase extends LivingEntity { public static final long MAX_POWER = 5000 * MjAPI.MJ; public static final long SAFETY_POWER = MAX_POWER / 5; public static final long SHUTDOWN_POWER = 0; public static final long NULL_ROBOT_ID = Long.MAX_VALUE; - public EntityRobotBase(EntityType entityType, Level par1World) { - super(entityType, par1World); + public EntityRobotBase(EntityType entityType, Level world) { + super(entityType, world); } - public abstract void setItemInUse(ItemStack stack); + public abstract void setItemInUse(@Nonnull ItemStack stack); public abstract void setItemActive(boolean b); diff --git a/api/buildcraft/api/robots/IRequestProvider.java b/api/buildcraft/api/robots/IRequestProvider.java index 22dbcb8..1e7bde5 100755 --- a/api/buildcraft/api/robots/IRequestProvider.java +++ b/api/buildcraft/api/robots/IRequestProvider.java @@ -6,6 +6,8 @@ import net.minecraft.world.item.ItemStack; +import javax.annotation.Nonnull; + /** Provide requests of items that need to be fulfilled. * * Requests are organized as an linear array, where null entries mark slots without a requests. A request in a slot, or @@ -21,6 +23,7 @@ public interface IRequestProvider { * * @param slot * @return the request in the slot, or null if there's no request. */ + @Nonnull ItemStack getRequest(int slot); /** Fulfill the request in slot with the stack given and return any excess. @@ -28,5 +31,6 @@ public interface IRequestProvider { * @param slot * @param stack * @return any excess that was not used to fulfill the request. */ + @Nonnull ItemStack offerItem(int slot, ItemStack stack); } diff --git a/api/buildcraft/api/robots/IRobotOverlayItem.java b/api/buildcraft/api/robots/IRobotOverlayItem.java index 6562302..d3e6a5f 100644 --- a/api/buildcraft/api/robots/IRobotOverlayItem.java +++ b/api/buildcraft/api/robots/IRobotOverlayItem.java @@ -1,6 +1,5 @@ package buildcraft.api.robots; -import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -9,5 +8,6 @@ public interface IRobotOverlayItem { boolean isValidRobotOverlay(ItemStack stack); @OnlyIn(Dist.CLIENT) - void renderRobotOverlay(ItemStack stack, TextureManager textureManager); + // void renderRobotOverlay(ItemStack stack, TextureManager textureManager); + void renderRobotOverlay(ItemStack stack); } diff --git a/api/buildcraft/api/robots/IStationFilter.java b/api/buildcraft/api/robots/IStationFilter.java new file mode 100644 index 0000000..809c08d --- /dev/null +++ b/api/buildcraft/api/robots/IStationFilter.java @@ -0,0 +1,10 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

    + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ +package buildcraft.api.robots; + +public interface IStationFilter { + + boolean matches(DockingStation station); +} diff --git a/api/buildcraft/api/statements/ActionState.java b/api/buildcraft/api/statements/ActionState.java new file mode 100644 index 0000000..b4c364c --- /dev/null +++ b/api/buildcraft/api/statements/ActionState.java @@ -0,0 +1,10 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +// Calen 1.18.2: from 1.8.9 +public class ActionState { + +} diff --git a/api/buildcraft/api/statements/IStatementParameter.java b/api/buildcraft/api/statements/IStatementParameter.java index e03889e..45a4d52 100755 --- a/api/buildcraft/api/statements/IStatementParameter.java +++ b/api/buildcraft/api/statements/IStatementParameter.java @@ -27,8 +27,10 @@ default DrawType getDrawType() { * possible values to be shown, or null if you did nothing and wish to show all possible values. * * @see #getPossible(IStatementContainer) */ - IStatementParameter onClick(IStatementContainer source, IStatement stmt, ItemStack stack, - StatementMouseClick mouse); + IStatementParameter onClick(IStatementContainer source, IStatement stmt, @Nonnull ItemStack stack, StatementMouseClick mouse); + + // Calen 1.18.2 + default IStatementParameter onScroll(IStatementContainer source, IStatement stmt, @Nonnull ItemStack stack, double delta) {return this;} void writeToNbt(CompoundTag nbt); diff --git a/api/buildcraft/api/statements/StatementParameterItemStack.java b/api/buildcraft/api/statements/StatementParameterItemStack.java index 34b4be2..b788935 100755 --- a/api/buildcraft/api/statements/StatementParameterItemStack.java +++ b/api/buildcraft/api/statements/StatementParameterItemStack.java @@ -76,9 +76,7 @@ public ItemStack getItemStack() { } @Override - public StatementParameterItemStack onClick( - IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse - ) { + public StatementParameterItemStack onClick(IStatementContainer source, IStatement stmt, @Nonnull ItemStack stack, StatementMouseClick mouse) { if (stack.isEmpty()) { return EMPTY; } else { diff --git a/api/buildcraft/api/transport/IStripesRegistry.java b/api/buildcraft/api/transport/IStripesRegistry.java index b9819e8..f71bb26 100644 --- a/api/buildcraft/api/transport/IStripesRegistry.java +++ b/api/buildcraft/api/transport/IStripesRegistry.java @@ -7,6 +7,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import java.util.EnumMap; +import java.util.List; + public interface IStripesRegistry { /** Adds a handler with a {@link EnumHandlerPriority} of {@linkplain EnumHandlerPriority#NORMAL} */ default void addHandler(IStripesHandlerItem handler) { @@ -37,4 +40,9 @@ boolean handleBlock(Level world, Direction direction, Player player, IStripesActivator activator); + + // Calen 1.18.2 + public EnumMap> getItemHandlers(); + + public EnumMap> getBlockHandlers(); } diff --git a/api/buildcraft/api/transport/pluggable/ActionIterator.java b/api/buildcraft/api/transport/pluggable/ActionIterator.java new file mode 100644 index 0000000..ecb9d5a --- /dev/null +++ b/api/buildcraft/api/transport/pluggable/ActionIterator.java @@ -0,0 +1,69 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

    + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ +package buildcraft.api.transport.pluggable; + +import buildcraft.api.gates.IGateProvider; +import buildcraft.api.statements.StatementSlot; +import buildcraft.api.transport.pipe.IPipe; +import net.minecraft.core.Direction; + +import java.util.Iterator; +import java.util.List; + +public class ActionIterator implements Iterable { + private final IPipe pipe; + + public ActionIterator(IPipe iPipe) { + pipe = iPipe; + } + + @Override + public Iterator iterator() { + return new It(); + } + + private class It implements Iterator { + + private Direction curDir = Direction.values()[0]; + private int index = 0; + + @Override + public boolean hasNext() { + return getNext(false) != null; + } + + @Override + public StatementSlot next() { + return getNext(true); + } + + private StatementSlot getNext(boolean advance) { + Direction curDir = this.curDir; + int index = this.index; + while (true) { + // List lst = pipe.hasGate(curDir) ? pipe.getGate(curDir).getActiveActions() : null; + List lst = pipe.getHolder().getPluggable(curDir) instanceof IGateProvider ? ((IGateProvider) pipe.getHolder().getPluggable(curDir)).getGate().getActiveActions() : null; + if (lst == null || index >= lst.size()) { + if (curDir.ordinal() == 5) { + return null; + } + curDir = Direction.values()[curDir.ordinal() + 1]; + } else { + index++; + if (advance) { + this.curDir = curDir; + this.index = index; + } + return lst.get(index - 1); + } + } + } + + @Override + public void remove() { + throw new UnsupportedOperationException("Remove not supported."); + } + } +} From 45263133cd5a95c989d7d51deab94d49d807d9bd Mon Sep 17 00:00:00 2001 From: CalenXwX Date: Thu, 24 Apr 2025 12:34:44 +0800 Subject: [PATCH 17/20] Update from latest commits of 1.12.2: Engine Pipe RF --- api/buildcraft/api/enums/EnumEngineType.java | 1 + api/buildcraft/api/mj/IMjToRfStatus.java | 43 ++++ api/buildcraft/api/mj/MjAPI.java | 8 + api/buildcraft/api/mj/MjCapabilityHelper.java | 119 +++++++++++ api/buildcraft/api/mj/MjRfConversion.java | 46 +++++ .../api/mj/MjToRfAutoConvertor.java | 192 ++++++++++++++++++ .../api/transport/pipe/IFlowPower.java | 3 +- .../api/transport/pipe/IFlowPowerLike.java | 6 + .../api/transport/pipe/IFlowRedstoneFlux.java | 18 ++ .../api/transport/pipe/PipeApi.java | 25 +++ .../api/transport/pipe/PipeEventPower.java | 9 + .../transport/pipe/PipeEventRedstoneFlux.java | 69 +++++++ .../api/transport/pipe/PipeFlow.java | 8 +- 13 files changed, 542 insertions(+), 5 deletions(-) create mode 100644 api/buildcraft/api/mj/IMjToRfStatus.java create mode 100644 api/buildcraft/api/mj/MjRfConversion.java create mode 100644 api/buildcraft/api/mj/MjToRfAutoConvertor.java create mode 100644 api/buildcraft/api/transport/pipe/IFlowPowerLike.java create mode 100644 api/buildcraft/api/transport/pipe/IFlowRedstoneFlux.java create mode 100644 api/buildcraft/api/transport/pipe/PipeEventRedstoneFlux.java diff --git a/api/buildcraft/api/enums/EnumEngineType.java b/api/buildcraft/api/enums/EnumEngineType.java index 0a86c93..68fc56e 100644 --- a/api/buildcraft/api/enums/EnumEngineType.java +++ b/api/buildcraft/api/enums/EnumEngineType.java @@ -9,6 +9,7 @@ public enum EnumEngineType implements StringRepresentable, IEngineType { IRON("energy", "iron"), // CREATIVE("energy", "creative"), CREATIVE("core", "creative"), + RF("energy", "rf"), ; public final String unlocalizedTag; diff --git a/api/buildcraft/api/mj/IMjToRfStatus.java b/api/buildcraft/api/mj/IMjToRfStatus.java new file mode 100644 index 0000000..525bf2c --- /dev/null +++ b/api/buildcraft/api/mj/IMjToRfStatus.java @@ -0,0 +1,43 @@ +package buildcraft.api.mj; + +import buildcraft.api.BCModules; + +public interface IMjToRfStatus { + + public static IMjToRfStatus get() { + return MjToRfStatusHolder.STATUS; + } + + MjRfConversion getConversion(); + + boolean isAutoconvertEnabled(); +} + +final class MjToRfStatusHolder implements IMjToRfStatus { + + static final IMjToRfStatus STATUS = get0(); + + private static IMjToRfStatus get0() { + if (BCModules.LIB.isLoaded()) { + try { + return (IMjToRfStatus) Class.forName("buildcraft.lib.BCLibConfig$MjToRfStatus").newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + throw new Error(e); + } + } else { + return new MjToRfStatusHolder(); + } + } + + private final MjRfConversion defaultConversion = MjRfConversion.createDefault(); + + @Override + public MjRfConversion getConversion() { + return defaultConversion; + } + + @Override + public boolean isAutoconvertEnabled() { + return false; + } +} diff --git a/api/buildcraft/api/mj/MjAPI.java b/api/buildcraft/api/mj/MjAPI.java index 282f0cb..b0438f1 100644 --- a/api/buildcraft/api/mj/MjAPI.java +++ b/api/buildcraft/api/mj/MjAPI.java @@ -45,6 +45,14 @@ private static String formatMjInternal(double val) { return MJ_DISPLAY_FORMAT.format(val); } + public static MjRfConversion getRfConversion() { + return IMjToRfStatus.get().getConversion(); + } + + public static boolean isRfAutoConversionEnabled() { + return IMjToRfStatus.get().isAutoconvertEnabled(); + } + // ######################################## // // Null based classes diff --git a/api/buildcraft/api/mj/MjCapabilityHelper.java b/api/buildcraft/api/mj/MjCapabilityHelper.java index ae9a9a1..723a167 100644 --- a/api/buildcraft/api/mj/MjCapabilityHelper.java +++ b/api/buildcraft/api/mj/MjCapabilityHelper.java @@ -4,6 +4,8 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.energy.CapabilityEnergy; +import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -26,12 +28,126 @@ public class MjCapabilityHelper implements ICapabilityProvider { @Nullable private final IMjPassiveProvider provider; + @Nullable + private final IEnergyStorage rfAutoConvert; + public MjCapabilityHelper(@Nonnull IMjConnector mj) { this.connector = mj; this.receiver = mj instanceof IMjReceiver ? (IMjReceiver) mj : null; this.rsReceiver = mj instanceof IMjRedstoneReceiver ? (IMjRedstoneReceiver) mj : null; this.readable = mj instanceof IMjReadable ? (IMjReadable) mj : null; this.provider = mj instanceof IMjPassiveProvider ? (IMjPassiveProvider) mj : null; + + if (MjAPI.isRfAutoConversionEnabled()) { + rfAutoConvert = new IEnergyStorage() { + + @Override + public int getEnergyStored() { + IMjReadable read = readable; + if (read != null) { + long mjPerRf = MjAPI.getRfConversion().mjPerRf; + return (int) (read.getStored() / mjPerRf); + } else { + return 0; + } + } + + @Override + public int getMaxEnergyStored() { + IMjReadable read = readable; + if (read != null) { + long mjPerRf = MjAPI.getRfConversion().mjPerRf; + return (int) (read.getCapacity() / mjPerRf); + } else { + return 0; + } + } + + @Override + public boolean canReceive() { + return receiver != null && receiver.canReceive(); + } + + /** @return Amount of energy that was (or would have been, if simulated) accepted by the storage. */ + @Override + public int receiveEnergy(int maxReceive, boolean simulate) { + + if (maxReceive <= 0) { + return 0; + } + + IMjReceiver recv = receiver; + if (recv == null || !recv.canReceive()) { + return 0; + } + + long mjPerRf = MjAPI.getRfConversion().mjPerRf; + long maxReceiveMj = maxReceive * mjPerRf; + long excess = recv.receivePower(maxReceiveMj, true); + + // Actual MJ that was accepted + long acceptedMj = maxReceiveMj - excess; + + if (acceptedMj < mjPerRf) { + return 0; + } + + // MJ that was accepted but cannot be converted back to RF + // (We need to actual accepted MJ to be some integer multiple of mjPerRf) + long excessMj = acceptedMj % mjPerRf; + // An MJ value that is an integer multiple of mjPerRf + long exactAcceptableMj = maxReceiveMj - excessMj; + + if (exactAcceptableMj <= 0) { + return 0; + } + + int rf = (int) (exactAcceptableMj / mjPerRf); + if (rf * mjPerRf != exactAcceptableMj) { + // Sanity check + throw new IllegalStateException( + "Programmer made a mistake?? mjPerRf=" + mjPerRf + ", rf=" + rf + ", exactAcceptableMJ=" + + exactAcceptableMj + ); + } + + long excess2 = recv.receivePower(exactAcceptableMj, true); + + if (excess2 != 0) { + // Odd. This means we can't actually accept the exact amount + // not actually a crash + return 0; + } + + if (!simulate) { + long excess3 = recv.receivePower(exactAcceptableMj, simulate); + + if (excess3 != excess2) { + throw new IllegalStateException("Bad impl: " + recv.getClass() + " of receivePower"); + } + } + + return rf; + } + + @Override + public boolean canExtract() { + return provider != null; + } + + /** @return Amount of energy that was (or would have been, if simulated) extracted from the storage. */ + @Override + public int extractEnergy(int maxExtract, boolean simulate) { + long mjPerRf = MjAPI.getRfConversion().mjPerRf; + // TODO! + // (Nothing in buildcraft supports this at the moment) + return 0; + } + + }; + } else { + rfAutoConvert = null; + } } // @Override @@ -61,6 +177,9 @@ public LazyOptional getCapability(@Nonnull Capability capability, Dire // return MjAPI.CAP_PASSIVE_PROVIDER.cast(provider); return provider == null ? LazyOptional.empty() : LazyOptional.of(() -> provider).cast(); } + if (capability == CapabilityEnergy.ENERGY) { + return provider == null ? LazyOptional.empty() : LazyOptional.of(() -> rfAutoConvert).cast(); + } return LazyOptional.empty(); } } diff --git a/api/buildcraft/api/mj/MjRfConversion.java b/api/buildcraft/api/mj/MjRfConversion.java new file mode 100644 index 0000000..8f922b9 --- /dev/null +++ b/api/buildcraft/api/mj/MjRfConversion.java @@ -0,0 +1,46 @@ +package buildcraft.api.mj; + +public class MjRfConversion { + + /** Maximum MJ per RF, or minimum of 5 RF to make 1 MJ. */ + public static final long MAX_MJ_PER_RF = MjAPI.MJ / 5; + + /** Minimum MJ per RF, or maximum of 10,000 RF to make 1 MJ */ + public static final long MIN_MJ_PER_RF = MjAPI.MJ / 10_000; + + /** Default MJ per RF. */ + public static final long DEFAULT_MJ_PER_RF = MjAPI.MJ / 10; + + /** micro MJ per 1 int rf. */ + public final long mjPerRf; + + /** Set to true if {@link #mjPerRf} has been set to the {@link #DEFAULT_MJ_PER_RF} because the passed in value was + * out-of-bounds. (This is used to differentiate between it being explicitly set to the default value). */ + public final boolean usingDefaultValue; + + private MjRfConversion(long mjPerRf) { + if (MIN_MJ_PER_RF <= mjPerRf && mjPerRf <= MAX_MJ_PER_RF) { + usingDefaultValue = false; + this.mjPerRf = mjPerRf; + } else { + usingDefaultValue = true; + this.mjPerRf = DEFAULT_MJ_PER_RF; + } + } + + /** @param mjPerRf Micro Minecraft Joules per 1 RF */ + public static MjRfConversion createRaw(long mjPerRf) { + return new MjRfConversion(mjPerRf); + } + + /** @param configMjPerRf {@link MjAPI#MJ} per RF. This is rounded to the nearest 100 micro MJ */ + public static MjRfConversion createParsed(double configMjPerRf) { + long value = Math.round(configMjPerRf * 10_000); + return new MjRfConversion(value * MjAPI.MJ / 10_000); + } + + public static MjRfConversion createDefault() { + // -10 is always out of range + return new MjRfConversion(-10); + } +} diff --git a/api/buildcraft/api/mj/MjToRfAutoConvertor.java b/api/buildcraft/api/mj/MjToRfAutoConvertor.java new file mode 100644 index 0000000..4507c6b --- /dev/null +++ b/api/buildcraft/api/mj/MjToRfAutoConvertor.java @@ -0,0 +1,192 @@ +package buildcraft.api.mj; + +import net.minecraftforge.energy.IEnergyStorage; + +/** Automatic conversion utility class for treating an RF {@link IEnergyStorage} in the MJ API. */ +public class MjToRfAutoConvertor implements IMjReadable { + + final IEnergyStorage rf; + + /** @return An {@link MjToRfAutoConvertor} that may implement {@link IMjPassiveProvider} and/or {@link IMjReceiver} + * if the given storage can provide/receive energy, or null if the given storage is null, or if + * RF<->MJ autoconversion is not enabled ( {@link MjAPI#isRfAutoConversionEnabled()} ) */ + public static MjToRfAutoConvertor create(IEnergyStorage rf) { + + if (rf == null) { + return null; + } + + if (!MjAPI.isRfAutoConversionEnabled()) { + return null; + } + + if (rf.canReceive()) { + if (rf.canExtract()) { + return new OfBoth(rf); + } else { + return new OfReceiver(rf); + } + } else { + if (rf.canExtract()) { + return new OfProvider(rf); + } else { + return new MjToRfAutoConvertor(rf); + } + } + } + + /** @return An {@link MjToRfAutoConvertor} that may implements {@link IMjReceiver} if the given storage can receive + * energy, or null if the given storage is null, or if RF<->MJ autoconversion is not enabled ( + * {@link MjAPI#isRfAutoConversionEnabled()} ) */ + public static IMjReceiver createReceiver(IEnergyStorage rf) { + MjToRfAutoConvertor convertor = create(rf); + if (convertor instanceof IMjReceiver) { + return (IMjReceiver) convertor; + } else { + return null; + } + } + + /** @return An {@link MjToRfAutoConvertor} that may implements {@link IMjPassiveProvider} if the given storage can + * provide energy, or null if the given storage is null, or if RF<->MJ autoconversion is not enabled ( + * {@link MjAPI#isRfAutoConversionEnabled()} ) */ + public static IMjPassiveProvider createProvider(IEnergyStorage rf) { + MjToRfAutoConvertor convertor = create(rf); + if (convertor instanceof IMjPassiveProvider) { + return (IMjPassiveProvider) convertor; + } else { + return null; + } + } + + MjToRfAutoConvertor(IEnergyStorage storage) { + this.rf = storage; + } + + /** @return true. (Redstone-like engines are expected to not connect due to this class never implementing + * {@link IMjRedstoneReceiver}) */ + @Override + public boolean canConnect(IMjConnector other) { + return true; + } + + @Override + public long getStored() { + return rf.getEnergyStored() * MjAPI.getRfConversion().mjPerRf; + } + + @Override + public long getCapacity() { + return rf.getMaxEnergyStored() * MjAPI.getRfConversion().mjPerRf; + } + + long implGetPowerRequested() { + return (rf.getMaxEnergyStored() - rf.getEnergyStored()) * MjAPI.getRfConversion().mjPerRf; + } + + /** @return excess */ + long implReceivePower(long microJoules, boolean simulate) { + if (!rf.canReceive()) { + return microJoules; + } + + long mjPerRf = MjAPI.getRfConversion().mjPerRf; + + int maxRf = (int) (microJoules / mjPerRf); + + if (maxRf <= 0) { + return microJoules; + } + + int received = rf.receiveEnergy(maxRf, simulate); + + return microJoules - received * mjPerRf; + } + + long implExtractPower(long min, long max, boolean simulate) { + + if (!rf.canExtract()) { + return 0; + } + + long mjPerRf = MjAPI.getRfConversion().mjPerRf; + + int maxRf = (int) (max / mjPerRf); + + if (maxRf <= 0) { + return 0; + } + + int extractedRF = rf.extractEnergy(maxRf, true); + long extractedMJ = extractedRF * mjPerRf; + if (extractedMJ < min) { + return 0; + } + + if (!simulate) { + rf.extractEnergy(maxRf, simulate); + } + + return extractedMJ; + } +} + +final class OfReceiver extends MjToRfAutoConvertor implements IMjReceiver { + + OfReceiver(IEnergyStorage storage) { + super(storage); + } + + @Override + public boolean canReceive() { + return rf.canReceive(); + } + + @Override + public long getPowerRequested() { + return implGetPowerRequested(); + } + + @Override + public long receivePower(long microJoules, boolean simulate) { + return implReceivePower(microJoules, simulate); + } +} + +final class OfProvider extends MjToRfAutoConvertor implements IMjPassiveProvider { + OfProvider(IEnergyStorage storage) { + super(storage); + } + + @Override + public long extractPower(long min, long max, boolean simulate) { + return implExtractPower(min, max, simulate); + } +} + +final class OfBoth extends MjToRfAutoConvertor implements IMjReceiver, IMjPassiveProvider { + + OfBoth(IEnergyStorage storage) { + super(storage); + } + + @Override + public boolean canReceive() { + return rf.canReceive(); + } + + @Override + public long getPowerRequested() { + return implGetPowerRequested(); + } + + @Override + public long receivePower(long microJoules, boolean simulate) { + return implReceivePower(microJoules, simulate); + } + + @Override + public long extractPower(long min, long max, boolean simulate) { + return implExtractPower(min, max, simulate); + } +} diff --git a/api/buildcraft/api/transport/pipe/IFlowPower.java b/api/buildcraft/api/transport/pipe/IFlowPower.java index 4b33292..a240e31 100644 --- a/api/buildcraft/api/transport/pipe/IFlowPower.java +++ b/api/buildcraft/api/transport/pipe/IFlowPower.java @@ -3,8 +3,9 @@ import buildcraft.api.mj.IMjPassiveProvider; import net.minecraft.core.Direction; -public interface IFlowPower { +public interface IFlowPower extends IFlowPowerLike { /** Makes this pipe reconfigure itself, possibly due to the addition of new modules. */ + @Override void reconfigure(); /** Attempts to extract power from the {@link IMjPassiveProvider} connected to this pipe on the given side. diff --git a/api/buildcraft/api/transport/pipe/IFlowPowerLike.java b/api/buildcraft/api/transport/pipe/IFlowPowerLike.java new file mode 100644 index 0000000..c56b085 --- /dev/null +++ b/api/buildcraft/api/transport/pipe/IFlowPowerLike.java @@ -0,0 +1,6 @@ +package buildcraft.api.transport.pipe; + +public interface IFlowPowerLike { + /** Makes this pipe reconfigure itself, possibly due to the addition of new modules. */ + void reconfigure(); +} diff --git a/api/buildcraft/api/transport/pipe/IFlowRedstoneFlux.java b/api/buildcraft/api/transport/pipe/IFlowRedstoneFlux.java new file mode 100644 index 0000000..d87b98c --- /dev/null +++ b/api/buildcraft/api/transport/pipe/IFlowRedstoneFlux.java @@ -0,0 +1,18 @@ +package buildcraft.api.transport.pipe; + +import net.minecraft.core.Direction; +import net.minecraftforge.energy.IEnergyStorage; + +public interface IFlowRedstoneFlux extends IFlowPowerLike { + /** Makes this pipe reconfigure itself, possibly due to the addition of new modules. */ + @Override + void reconfigure(); + + /** Attempts to extract power from the {@link IEnergyStorage} connected to this pipe on the given side. + * + * @param maxPower The Maximum amount of power that can be extracted. + * @param from The side (of this pipe) to take power from. + * @return The amount of power extracted. */ + // int tryExtractPower(int maxPower, EnumFacing from); + int tryExtractPower(int maxPower, Direction from); +} diff --git a/api/buildcraft/api/transport/pipe/PipeApi.java b/api/buildcraft/api/transport/pipe/PipeApi.java index 904d2c1..1eace25 100644 --- a/api/buildcraft/api/transport/pipe/PipeApi.java +++ b/api/buildcraft/api/transport/pipe/PipeApi.java @@ -25,6 +25,7 @@ public final class PipeApi { public static PipeFlowType flowItems; public static PipeFlowType flowFluids; public static PipeFlowType flowPower; + public static PipeFlowType flowRf; /** The default transfer information used if a pipe definition has not been registered. Note that this is replaced * by BuildCraft Transport to config-defined values. */ @@ -34,8 +35,13 @@ public final class PipeApi { * by BuildCraft Transport to config-defined values. */ public static PowerTransferInfo powerInfoDefault = PowerTransferInfo.createFromResistance(8 * MjAPI.MJ, MjAPI.MJ / 32, false); + /** The default transfer information used if a pipe definition has not been registered. Note that this is replaced + * by BuildCraft Transport to config-defined values. */ + public static RedstoneFluxTransferInfo rfInfoDefault = new RedstoneFluxTransferInfo(80, false); + public static final Map fluidTransferData = new IdentityHashMap<>(); public static final Map powerTransferData = new IdentityHashMap<>(); + public static final Map rfTransferData = new IdentityHashMap<>(); @Nonnull public static final Capability CAP_PIPE_HOLDER = CapabilityManager.get(new CapabilityToken<>() { @@ -71,6 +77,15 @@ public static PowerTransferInfo getPowerTransferInfo(PipeDefinition def) { } } + public static RedstoneFluxTransferInfo getRfTransferInfo(PipeDefinition def) { + RedstoneFluxTransferInfo info = rfTransferData.get(def); + if (info == null) { + return rfInfoDefault; + } else { + return info; + } + } + public static class FluidTransferInfo { /** Controls the maximum amount of fluid that can be transferred around and out of a pipe per tick. Note that * this does not affect the flow rate coming into the pipe. */ @@ -126,6 +141,16 @@ public PowerTransferInfo(long transferPerTick, long lossPerTick, long resistance } } + public static class RedstoneFluxTransferInfo { + public final int transferPerTick; + public final boolean isReceiver; + + public RedstoneFluxTransferInfo(int transferPerTick, boolean isReceiver) { + this.transferPerTick = transferPerTick; + this.isReceiver = isReceiver; + } + } + // Internals @SubscribeEvent diff --git a/api/buildcraft/api/transport/pipe/PipeEventPower.java b/api/buildcraft/api/transport/pipe/PipeEventPower.java index fc30a20..4c23d2a 100644 --- a/api/buildcraft/api/transport/pipe/PipeEventPower.java +++ b/api/buildcraft/api/transport/pipe/PipeEventPower.java @@ -25,6 +25,7 @@ public static class Configure extends PipeEventPower { * or by {@link #powerResistance} if it is set. This is capped at the value given in {@link #getMaxPower()} */ private long powerLoss = -1; private boolean receiver = false; + private boolean disabled = false; public Configure(IPipeHolder holder, IFlowPower flow) { super(holder, flow); @@ -70,6 +71,14 @@ public boolean isReceiver() { public void setReceiver(boolean receiver) { this.receiver = receiver; } + + public void disableTransfer() { + disabled = true; + } + + public boolean isTransferDisabled() { + return disabled; + } } public static class PrimaryDirection extends PipeEventPower { diff --git a/api/buildcraft/api/transport/pipe/PipeEventRedstoneFlux.java b/api/buildcraft/api/transport/pipe/PipeEventRedstoneFlux.java new file mode 100644 index 0000000..bf66008 --- /dev/null +++ b/api/buildcraft/api/transport/pipe/PipeEventRedstoneFlux.java @@ -0,0 +1,69 @@ +package buildcraft.api.transport.pipe; + +import net.minecraft.core.Direction; + +public abstract class PipeEventRedstoneFlux extends PipeEvent { + public final IFlowRedstoneFlux flow; + + protected PipeEventRedstoneFlux(IPipeHolder holder, IFlowRedstoneFlux flow) { + super(holder); + this.flow = flow; + } + + protected PipeEventRedstoneFlux(boolean canBeCancelled, IPipeHolder holder, IFlowRedstoneFlux flow) { + super(canBeCancelled, holder); + this.flow = flow; + } + + public static class Configure extends PipeEventRedstoneFlux { + private int maxPower = 100; + private boolean receiver = false; + private boolean disabled = false; + + public Configure(IPipeHolder holder, IFlowRedstoneFlux flow) { + super(holder, flow); + } + + public int getMaxPower() { + return this.maxPower; + } + + public void setMaxPower(int maxPower) { + this.maxPower = maxPower; + } + + public boolean isReceiver() { + return this.receiver; + } + + /** Sets this pipe to be one that receives power from external sources. */ + public void setReceiver(boolean receiver) { + this.receiver = receiver; + } + + public void disableTransfer() { + disabled = true; + } + + public boolean isTransferDisabled() { + return disabled; + } + } + + public static class PrimaryDirection extends PipeEventRedstoneFlux { + private Direction facing; + + public PrimaryDirection(IPipeHolder holder, IFlowRedstoneFlux flow, Direction facing) { + super(holder, flow); + this.facing = facing; + } + + public Direction getFacing() { + return facing; + } + + public void setFacing(Direction facing) { + this.facing = facing; + } + } +} diff --git a/api/buildcraft/api/transport/pipe/PipeFlow.java b/api/buildcraft/api/transport/pipe/PipeFlow.java index 12222d8..4608edb 100644 --- a/api/buildcraft/api/transport/pipe/PipeFlow.java +++ b/api/buildcraft/api/transport/pipe/PipeFlow.java @@ -73,11 +73,11 @@ public boolean shouldForceConnection(Direction face, BlockEntity oTile) { return false; } - public void onTick() { - } + public void onTick() {} - public void addDrops(NonNullList toDrop, int fortune) { - } + public void postPluggableTick() {} + + public void addDrops(NonNullList toDrop, int fortune) {} public boolean onFlowActivate(Player player, HitResult trace, float hitX, float hitY, float hitZ, EnumPipePart part) { From 405c385bb2ffe5df853b532bcf92869417c721b5 Mon Sep 17 00:00:00 2001 From: CalenXwX Date: Thu, 24 Apr 2025 18:38:36 +0800 Subject: [PATCH 18/20] Update engine type --- api/buildcraft/api/core/IEngineType.java | 5 +++- api/buildcraft/api/enums/EnumEngineType.java | 24 +++++++++++--------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/api/buildcraft/api/core/IEngineType.java b/api/buildcraft/api/core/IEngineType.java index d6fc9c3..ee1ae91 100644 --- a/api/buildcraft/api/core/IEngineType.java +++ b/api/buildcraft/api/core/IEngineType.java @@ -1,5 +1,8 @@ package buildcraft.api.core; +import net.minecraft.resources.ResourceLocation; + public interface IEngineType { -// String getItemModelLocation(); + // String getItemModelLocation(); + ResourceLocation getItemModelLocation(); } diff --git a/api/buildcraft/api/enums/EnumEngineType.java b/api/buildcraft/api/enums/EnumEngineType.java index 68fc56e..2bb54e1 100644 --- a/api/buildcraft/api/enums/EnumEngineType.java +++ b/api/buildcraft/api/enums/EnumEngineType.java @@ -1,32 +1,34 @@ package buildcraft.api.enums; import buildcraft.api.core.IEngineType; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.StringRepresentable; public enum EnumEngineType implements StringRepresentable, IEngineType { WOOD("core", "wood"), - STONE("energy", "stone"), - IRON("energy", "iron"), - // CREATIVE("energy", "creative"), + STONE("core", "stone"), + IRON("core", "iron"), CREATIVE("core", "creative"), - RF("energy", "rf"), + RF("core", "rf"), ; public final String unlocalizedTag; - @Deprecated(forRemoval = true) - public final String resourceLocation; + // public final String resourceLocation; + public final ResourceLocation resourceLocation; public static final EnumEngineType[] VALUES = values(); EnumEngineType(String mod, String loc) { unlocalizedTag = loc; - resourceLocation = "buildcraft" + mod + ":blocks/engine/inv/" + loc; + // resourceLocation = "buildcraft" + mod + ":blocks/engine/inv/" + loc; + resourceLocation = new ResourceLocation("buildcraft" + mod, "engine_" + loc); } -// @Override -// public String getItemModelLocation() { -// return resourceLocation; -// } + @Override + // public String getItemModelLocation() + public ResourceLocation getItemModelLocation() { + return resourceLocation; + } @Override public String getSerializedName() { From 938cec3cb383ef178765ba390104ac5751b429bd Mon Sep 17 00:00:00 2001 From: CalenXwX Date: Sat, 26 Apr 2025 14:57:07 +0800 Subject: [PATCH 19/20] Update IMessage --- api/buildcraft/api/net/IMessage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/buildcraft/api/net/IMessage.java b/api/buildcraft/api/net/IMessage.java index 612c15c..4e16d57 100644 --- a/api/buildcraft/api/net/IMessage.java +++ b/api/buildcraft/api/net/IMessage.java @@ -8,9 +8,9 @@ public interface IMessage { void toBytes(FriendlyByteBuf buf); - public static IMessage staticFromBytes(Class clazz, FriendlyByteBuf buf) { + public static MSG staticFromBytes(Class clazz, FriendlyByteBuf buf) { try { - IMessage message = clazz.newInstance(); + MSG message = clazz.newInstance(); message.fromBytes(buf); return message; } catch (Exception e) { From 8e47aad467c089832dc249240616d11912d3d8ba Mon Sep 17 00:00:00 2001 From: CalenXwX Date: Wed, 7 May 2025 21:48:50 +0800 Subject: [PATCH 20/20] Fix MJ-RF conversion --- api/buildcraft/api/mj/MjCapabilityHelper.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/buildcraft/api/mj/MjCapabilityHelper.java b/api/buildcraft/api/mj/MjCapabilityHelper.java index 723a167..48f95e8 100644 --- a/api/buildcraft/api/mj/MjCapabilityHelper.java +++ b/api/buildcraft/api/mj/MjCapabilityHelper.java @@ -96,7 +96,9 @@ public int receiveEnergy(int maxReceive, boolean simulate) { // (We need to actual accepted MJ to be some integer multiple of mjPerRf) long excessMj = acceptedMj % mjPerRf; // An MJ value that is an integer multiple of mjPerRf - long exactAcceptableMj = maxReceiveMj - excessMj; + // Calen FIX: acceptedMj, not maxReceiveMj + // long exactAcceptableMj = maxReceiveMj - excessMj; + long exactAcceptableMj = acceptedMj - excessMj; if (exactAcceptableMj <= 0) { return 0; @@ -178,7 +180,7 @@ public LazyOptional getCapability(@Nonnull Capability capability, Dire return provider == null ? LazyOptional.empty() : LazyOptional.of(() -> provider).cast(); } if (capability == CapabilityEnergy.ENERGY) { - return provider == null ? LazyOptional.empty() : LazyOptional.of(() -> rfAutoConvert).cast(); + return rfAutoConvert == null ? LazyOptional.empty() : LazyOptional.of(() -> rfAutoConvert).cast(); } return LazyOptional.empty(); }