mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-20 12:23:48 +01:00
3d68bec18a
- All Items are now using registrate
- Blockzapper now renders an outline around its affected area
- Ported rainbow debug ™️
- Reworked the custom item model/renderer system
- Schematics now preview their structure again
- SuperByteBuffers now support being rendered into non-BufferBuilders
65 lines
2.4 KiB
Java
65 lines
2.4 KiB
Java
package com.simibubi.create.content.palettes;
|
|
|
|
import static com.simibubi.create.foundation.data.CreateRegistrate.connectedTextures;
|
|
|
|
import com.google.common.collect.ImmutableList;
|
|
import com.simibubi.create.AllColorHandlers;
|
|
import com.simibubi.create.Create;
|
|
import com.simibubi.create.foundation.data.CreateRegistrate;
|
|
import com.simibubi.create.foundation.utility.Lang;
|
|
import com.tterrag.registrate.builders.BlockBuilder;
|
|
import com.tterrag.registrate.util.entry.BlockEntry;
|
|
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
|
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.client.renderer.RenderType;
|
|
|
|
public class PalettesVariantEntry {
|
|
|
|
public ImmutableList<BlockEntry<? extends Block>> registeredBlocks;
|
|
public ImmutableList<BlockEntry<? extends Block>> registeredPartials;
|
|
|
|
public PalettesVariantEntry(PaletteStoneVariants variant, PaletteBlockPatterns[] patterns,
|
|
NonNullSupplier<? extends Block> initialProperties) {
|
|
|
|
String name = Lang.asId(variant.name());
|
|
ImmutableList.Builder<BlockEntry<? extends Block>> registeredBlocks = ImmutableList.builder();
|
|
ImmutableList.Builder<BlockEntry<? extends Block>> registeredPartials = ImmutableList.builder();
|
|
for (PaletteBlockPatterns pattern : patterns) {
|
|
|
|
CreateRegistrate registrate = Create.registrate();
|
|
BlockBuilder<? extends Block, CreateRegistrate> builder =
|
|
registrate.block(pattern.createName(name), pattern.getBlockFactory())
|
|
.initialProperties(initialProperties)
|
|
.blockstate(pattern.getBlockStateGenerator()
|
|
.apply(pattern)
|
|
.apply(name)::accept);
|
|
|
|
if (pattern.isTranslucent())
|
|
builder.addLayer(() -> RenderType::getTranslucent);
|
|
if (pattern.hasFoliage())
|
|
builder.onRegister(CreateRegistrate.blockColors(() -> AllColorHandlers::getGrassyBlock));
|
|
pattern.createCTBehaviour(variant)
|
|
.ifPresent(b -> builder.onRegister(connectedTextures(b)));
|
|
|
|
if (pattern.hasFoliage())
|
|
builder.item()
|
|
.onRegister(CreateRegistrate.itemColors(() -> AllColorHandlers::getGrassyItem))
|
|
.build();
|
|
else
|
|
builder.simpleItem();
|
|
|
|
BlockEntry<? extends Block> block = builder.register();
|
|
registeredBlocks.add(block);
|
|
|
|
for (PaletteBlockPartial<? extends Block> partialBlock : pattern.getPartials())
|
|
registeredPartials.add(partialBlock.create(name, pattern, block)
|
|
.register());
|
|
|
|
}
|
|
this.registeredBlocks = registeredBlocks.build();
|
|
this.registeredPartials = registeredPartials.build();
|
|
|
|
}
|
|
|
|
}
|