bucketOil

基本信息

属性 值
注册名 bucketOil
本地名 bucketOil
物品类 ItemBucketGC
所属 modid GalacticraftCore
注册变量 GCItems.bucketOil / bucketOil
构造 core/GalacticraftCore.java:456 — new ItemBucketGC(GCBlocks.crudeOil, TEXTURE_PREFIX)
注册名来源 core/GalacticraftCore.java:457 — GCItems.bucketOil.setUnlocalizedName("bucketOil")
注册 core/GalacticraftCore.java:458 — GCItems.registerItem(GCItems.bucketOil)
源码 micdoodle8/mods/galacticraft/core/GalacticraftCore.java

说明

⚠️ 这个物品不在 GCItems.java 里注册——GCItems.registerItems() (GCItems.java:279-328)里没有 bucketOil。 它的构造、命名、注册全在 core/GalacticraftCore.java:455-463, 夹在原油流体块的注册之后。

双重条件门控(core/GalacticraftCore.java:455):

if (GCBlocks.crudeOil != null && Item.itemRegistry.getObject("buildcraftenergy:items/bucketOil") == null) {
    GCItems.bucketOil = new ItemBucketGC(GCBlocks.crudeOil, TEXTURE_PREFIX);
    GCItems.bucketOil.setUnlocalizedName("bucketOil");
    GCItems.registerItem(GCItems.bucketOil);
    FluidContainerRegistry.registerFluidContainer(
            FluidRegistry.getFluidStack(oilID, FluidContainerRegistry.BUCKET_VOLUME),
            new ItemStack(GCItems.bucketOil),
            new ItemStack(Items.bucket));
}

两个条件缺一不可:

  1. GCBlocks.crudeOil != null——原油流体块得先建起来(它自己又受 fluidOil.getBlock() == null 门控)。
  2. Item.itemRegistry.getObject("buildcraftenergy:items/bucketOil") == null ——BuildCraft Energy 已经提供了油桶时,GC 就不注册自己的, 避免两个 mod 抢同一个桶。

注册走的是 GCItems.registerItem(Item),即 GCItems.java:330-332 那个 写死 Constants.MOD_ID_CORE 的实现——与本物品所属 modid 一致,没有归属错误。

FluidContainerRegistry.registerFluidContainer(...)(:459-463) 把它登记成「油流体 ↔ 桶」的容器对,填桶/倒桶都靠它。

相关条目