mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-14 14:43:49 +01:00
Config shenanigans & Terraforged support
- Serverconfig now registers together with the others - Added missing stress config entries for components without a default stress impact greater than zero - bumped version - Tagged stone variants from Create palettes to generate in a terraforged world type
This commit is contained in:
parent
cfdc9d0a5e
commit
9005eae338
12 changed files with 94 additions and 33 deletions
|
@ -16,7 +16,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
|||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = 'mc1.15.2_v0.2.3'
|
||||
version = 'mc1.15.2_v0.2.4'
|
||||
group = 'com.simibubi.create'
|
||||
archivesBaseName = 'create'
|
||||
|
||||
|
|
|
@ -151,12 +151,14 @@ public class AllBlocks {
|
|||
|
||||
public static final BlockEntry<ShaftBlock> SHAFT = REGISTRATE.block("shaft", ShaftBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(BlockStateGen.axisBlockProvider(false))
|
||||
.simpleItem()
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<CogWheelBlock> COGWHEEL = REGISTRATE.block("cogwheel", CogWheelBlock::small)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.properties(p -> p.sound(SoundType.WOOD))
|
||||
.blockstate(BlockStateGen.axisBlockProvider(false))
|
||||
.item(CogwheelBlockItem::new)
|
||||
|
@ -167,6 +169,7 @@ public class AllBlocks {
|
|||
REGISTRATE.block("large_cogwheel", CogWheelBlock::large)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.sound(SoundType.WOOD))
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(BlockStateGen.axisBlockProvider(false))
|
||||
.item(CogwheelBlockItem::new)
|
||||
.build()
|
||||
|
@ -176,6 +179,7 @@ public class AllBlocks {
|
|||
REGISTRATE.block("encased_shaft", EncasedShaftBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.nonOpaque())
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(BlockStateGen.axisBlockProvider(true))
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
|
@ -184,6 +188,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.nonOpaque())
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(BlockStateGen.axisBlockProvider(true))
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
|
@ -192,6 +197,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<ClutchBlock> CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.nonOpaque())
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
|
@ -200,6 +206,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<GearshiftBlock> GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.nonOpaque())
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
|
@ -209,6 +216,7 @@ public class AllBlocks {
|
|||
REGISTRATE.block("encased_belt", EncasedBeltBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.nonOpaque())
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> p.models()
|
||||
.getExistingFile(p.modLoc("block/" + c.getName() + "/" + suffix))).generate(c, p))
|
||||
.item()
|
||||
|
@ -219,6 +227,7 @@ public class AllBlocks {
|
|||
REGISTRATE.block("adjustable_pulley", AdjustablePulleyBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.nonOpaque())
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> {
|
||||
String powered = state.get(AdjustablePulleyBlock.POWERED) ? "_powered" : "";
|
||||
return p.models()
|
||||
|
@ -357,6 +366,7 @@ public class AllBlocks {
|
|||
|
||||
public static final BlockEntry<GaugeBlock> SPEEDOMETER = REGISTRATE.block("speedometer", GaugeBlock::speed)
|
||||
.initialProperties(SharedProperties::wooden)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(new GaugeGenerator()::generate)
|
||||
.item()
|
||||
.transform(ModelGen.customItemModel("gauge", "_", "item"))
|
||||
|
@ -364,6 +374,7 @@ public class AllBlocks {
|
|||
|
||||
public static final BlockEntry<GaugeBlock> STRESSOMETER = REGISTRATE.block("stressometer", GaugeBlock::stress)
|
||||
.initialProperties(SharedProperties::wooden)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(new GaugeGenerator()::generate)
|
||||
.item()
|
||||
.transform(ModelGen.customItemModel("gauge", "_", "item"))
|
||||
|
@ -554,6 +565,7 @@ public class AllBlocks {
|
|||
REGISTRATE.block("sequenced_gearshift", SequencedGearshiftBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.nonOpaque())
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(new SequencedGearshiftGenerator()::generate)
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
|
@ -562,6 +574,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<FlywheelBlock> FLYWHEEL = REGISTRATE.block("flywheel", FlywheelBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.properties(p -> p.nonOpaque())
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(new FlywheelGenerator()::generate)
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
|
@ -579,6 +592,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<SpeedControllerBlock> ROTATION_SPEED_CONTROLLER =
|
||||
REGISTRATE.block("rotation_speed_controller", SpeedControllerBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(BlockStateGen.horizontalAxisBlockProvider(true))
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
|
|
|
@ -38,7 +38,7 @@ public class Create {
|
|||
|
||||
public static final String ID = "create";
|
||||
public static final String NAME = "Create";
|
||||
public static final String VERSION = "0.2.3";
|
||||
public static final String VERSION = "0.2.4";
|
||||
|
||||
public static Logger logger = LogManager.getLogger();
|
||||
public static ItemGroup baseCreativeTab = new CreateItemGroup();
|
||||
|
@ -54,7 +54,6 @@ public class Create {
|
|||
public Create() {
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get()
|
||||
.getModEventBus();
|
||||
modEventBus.addListener(Create::init);
|
||||
|
||||
AllBlocks.register();
|
||||
AllItems.register();
|
||||
|
@ -62,18 +61,16 @@ public class Create {
|
|||
AllEntityTypes.register();
|
||||
AllTileEntities.register();
|
||||
|
||||
modEventBus.addListener(Create::init);
|
||||
modEventBus.addGenericListener(IRecipeSerializer.class, AllRecipeTypes::register);
|
||||
modEventBus.addGenericListener(ContainerType.class, AllContainerTypes::register);
|
||||
modEventBus.addGenericListener(ParticleType.class, AllParticleTypes::register);
|
||||
modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register);
|
||||
modEventBus.addListener(AllConfigs::onLoad);
|
||||
modEventBus.addListener(AllConfigs::onReload);
|
||||
|
||||
// Ensure registrate runs first
|
||||
modEventBus.addListener(EventPriority.LOWEST, this::gatherData);
|
||||
|
||||
CreateClient.addListeners(modEventBus);
|
||||
AllConfigs.registerClientCommon();
|
||||
CreateClient.addClientListeners(modEventBus);
|
||||
AllConfigs.register();
|
||||
}
|
||||
|
||||
public static void init(final FMLCommonSetupEvent event) {
|
||||
|
@ -84,9 +81,7 @@ public class Create {
|
|||
|
||||
AllPackets.registerPackets();
|
||||
AllTriggers.register();
|
||||
|
||||
AllWorldFeatures.reload();
|
||||
AllConfigs.registerServer();
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
|
|
|
@ -61,7 +61,7 @@ public class CreateClient {
|
|||
private static CustomRenderedItems customRenderedItems;
|
||||
private static AllColorHandlers colorHandlers;
|
||||
|
||||
public static void addListeners(IEventBus modEventBus) {
|
||||
public static void addClientListeners(IEventBus modEventBus) {
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
||||
modEventBus.addListener(CreateClient::clientInit);
|
||||
modEventBus.addListener(CreateClient::onModelBake);
|
||||
|
|
|
@ -108,33 +108,35 @@ public class AllPaletteBlocks {
|
|||
.register();
|
||||
|
||||
public static final BlockEntry<Block> LIMESTONE =
|
||||
REGISTRATE.baseBlock("limestone", Block::new, () -> Blocks.SANDSTONE)
|
||||
REGISTRATE.baseBlock("limestone", Block::new, () -> Blocks.SANDSTONE, true)
|
||||
.register();
|
||||
|
||||
public static final PalettesVariantEntry LIMESTONE_VARIANTS =
|
||||
new PalettesVariantEntry(PaletteStoneVariants.LIMESTONE, PaletteBlockPatterns.standardRange, LIMESTONE);
|
||||
|
||||
public static final BlockEntry<Block> WEATHERED_LIMESTONE =
|
||||
REGISTRATE.baseBlock("weathered_limestone", Block::new, () -> Blocks.SANDSTONE)
|
||||
REGISTRATE.baseBlock("weathered_limestone", Block::new, () -> Blocks.SANDSTONE, true)
|
||||
.register();
|
||||
|
||||
public static final PalettesVariantEntry WEATHERED_LIMESTONE_VARIANTS = new PalettesVariantEntry(
|
||||
PaletteStoneVariants.WEATHERED_LIMESTONE, PaletteBlockPatterns.standardRange, WEATHERED_LIMESTONE);
|
||||
|
||||
public static final BlockEntry<Block> DOLOMITE =
|
||||
REGISTRATE.baseBlock("dolomite", Block::new, () -> Blocks.QUARTZ_BLOCK)
|
||||
REGISTRATE.baseBlock("dolomite", Block::new, () -> Blocks.QUARTZ_BLOCK, true)
|
||||
.register();
|
||||
|
||||
public static final PalettesVariantEntry DOLOMITE_VARIANTS =
|
||||
new PalettesVariantEntry(PaletteStoneVariants.DOLOMITE, PaletteBlockPatterns.standardRange, DOLOMITE);
|
||||
|
||||
public static final BlockEntry<Block> GABBRO = REGISTRATE.baseBlock("gabbro", Block::new, () -> Blocks.ANDESITE)
|
||||
public static final BlockEntry<Block> GABBRO =
|
||||
REGISTRATE.baseBlock("gabbro", Block::new, () -> Blocks.ANDESITE, true)
|
||||
.register();
|
||||
|
||||
public static final PalettesVariantEntry GABBRO_VARIANTS =
|
||||
new PalettesVariantEntry(PaletteStoneVariants.GABBRO, PaletteBlockPatterns.standardRange, GABBRO);
|
||||
|
||||
public static final BlockEntry<Block> SCORIA = REGISTRATE.baseBlock("scoria", Block::new, () -> Blocks.ANDESITE)
|
||||
public static final BlockEntry<Block> SCORIA =
|
||||
REGISTRATE.baseBlock("scoria", Block::new, () -> Blocks.ANDESITE, true)
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<Block> NATURAL_SCORIA = REGISTRATE.block("natural_scoria", Block::new)
|
||||
|
@ -149,7 +151,7 @@ public class AllPaletteBlocks {
|
|||
new PalettesVariantEntry(PaletteStoneVariants.SCORIA, PaletteBlockPatterns.standardRange, SCORIA);
|
||||
|
||||
public static final BlockEntry<Block> DARK_SCORIA =
|
||||
REGISTRATE.baseBlock("dark_scoria", Block::new, () -> Blocks.ANDESITE)
|
||||
REGISTRATE.baseBlock("dark_scoria", Block::new, () -> Blocks.ANDESITE, false)
|
||||
.register();
|
||||
|
||||
public static final PalettesVariantEntry DARK_SCORIA_VARIANTS =
|
||||
|
|
|
@ -33,28 +33,29 @@ public class AllConfigs {
|
|||
return config;
|
||||
}
|
||||
|
||||
public static void registerClientCommon() {
|
||||
public static void register() {
|
||||
CLIENT = register(CClient::new, ModConfig.Type.CLIENT);
|
||||
COMMON = register(CCommon::new, ModConfig.Type.COMMON);
|
||||
for (Entry<ConfigBase, Type> pair : configs.entrySet())
|
||||
if (pair.getValue() != Type.SERVER)
|
||||
ModLoadingContext.get().registerConfig(pair.getValue(), pair.getKey().specification);
|
||||
}
|
||||
|
||||
public static void registerServer() {
|
||||
SERVER = register(CServer::new, ModConfig.Type.SERVER);
|
||||
ModLoadingContext.get().registerConfig(configs.get(SERVER), SERVER.specification);
|
||||
|
||||
for (Entry<ConfigBase, Type> pair : configs.entrySet())
|
||||
ModLoadingContext.get()
|
||||
.registerConfig(pair.getValue(), pair.getKey().specification);
|
||||
}
|
||||
|
||||
public static void onLoad(ModConfig.Loading event) {
|
||||
for (Entry<ConfigBase, Type> pair : configs.entrySet())
|
||||
if (pair.getKey().specification == event.getConfig().getSpec())
|
||||
pair.getKey().onLoad();
|
||||
if (pair.getKey().specification == event.getConfig()
|
||||
.getSpec())
|
||||
pair.getKey()
|
||||
.onLoad();
|
||||
}
|
||||
|
||||
public static void onReload(ModConfig.Reloading event) {
|
||||
for (Entry<ConfigBase, Type> pair : configs.entrySet())
|
||||
if (pair.getKey().specification == event.getConfig().getSpec())
|
||||
pair.getKey().onReload();
|
||||
if (pair.getKey().specification == event.getConfig()
|
||||
.getSpec())
|
||||
pair.getKey()
|
||||
.onReload();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@ public class StressConfigDefaults {
|
|||
static Map<ResourceLocation, Double> registeredDefaultImpacts = new HashMap<>();
|
||||
static Map<ResourceLocation, Double> registeredDefaultCapacities = new HashMap<>();
|
||||
|
||||
public static <B extends Block, P> NonNullUnaryOperator<BlockBuilder<B, P>> setNoImpact() {
|
||||
return setImpact(0);
|
||||
}
|
||||
|
||||
public static <B extends Block, P> NonNullUnaryOperator<BlockBuilder<B, P>> setImpact(double impact) {
|
||||
return b -> {
|
||||
registeredDefaultImpacts.put(Create.asResource(b.getName()), impact);
|
||||
|
|
|
@ -102,12 +102,13 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
|
|||
/* Palettes */
|
||||
|
||||
public <T extends Block> BlockBuilder<T, CreateRegistrate> baseBlock(String name,
|
||||
NonNullFunction<Properties, T> factory, NonNullSupplier<Block> propertiesFrom) {
|
||||
NonNullFunction<Properties, T> factory, NonNullSupplier<Block> propertiesFrom, boolean TFworldGen) {
|
||||
return super.block(name, factory).initialProperties(propertiesFrom)
|
||||
.blockstate((c, p) -> {
|
||||
final String location = "block/palettes/" + c.getName() + "/plain";
|
||||
p.simpleBlock(c.get(), p.models()
|
||||
.cubeAll(c.getName(), p.modLoc(location)));
|
||||
// TODO tag with forge:stone; if TFWorldGen == true tag with forge:wg_stone aswell
|
||||
})
|
||||
.simpleItem();
|
||||
}
|
||||
|
|
17
src/main/resources/data/forge/tags/blocks/stone.json
Normal file
17
src/main/resources/data/forge/tags/blocks/stone.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:limestone",
|
||||
"create:polished_limestone",
|
||||
"create:weathered_limestone",
|
||||
"create:polished_weathered_limestone",
|
||||
"create:gabbro",
|
||||
"create:polished_gabbro",
|
||||
"create:dolomite",
|
||||
"create:polished_dolomite",
|
||||
"create:scoria",
|
||||
"create:polished_scoria",
|
||||
"create:dark_scoria",
|
||||
"create:polished_dark_scoria"
|
||||
]
|
||||
}
|
10
src/main/resources/data/forge/tags/blocks/wg_stone.json
Normal file
10
src/main/resources/data/forge/tags/blocks/wg_stone.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:limestone",
|
||||
"create:weathered_limestone",
|
||||
"create:gabbro",
|
||||
"create:dolomite",
|
||||
"create:natural_scoria"
|
||||
]
|
||||
}
|
17
src/main/resources/data/forge/tags/items/stone.json
Normal file
17
src/main/resources/data/forge/tags/items/stone.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:limestone",
|
||||
"create:polished_limestone",
|
||||
"create:weathered_limestone",
|
||||
"create:polished_weathered_limestone",
|
||||
"create:gabbro",
|
||||
"create:polished_gabbro",
|
||||
"create:dolomite",
|
||||
"create:polished_dolomite",
|
||||
"create:scoria",
|
||||
"create:polished_scoria",
|
||||
"create:dark_scoria",
|
||||
"create:polished_dark_scoria"
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue