-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45b6f33
commit d337e6d
Showing
5 changed files
with
66 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/dev/latvian/mods/kubejs/block/custom/CarpetBlockBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package dev.latvian.mods.kubejs.block.custom; | ||
|
||
import dev.latvian.mods.kubejs.client.VariantBlockStateGenerator; | ||
import dev.latvian.mods.kubejs.generator.AssetJsonGenerator; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.tags.BlockTags; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.CarpetBlock; | ||
|
||
public class CarpetBlockBuilder extends ShapedBlockBuilder { | ||
public CarpetBlockBuilder(ResourceLocation i) { | ||
super(i, "_carpet"); | ||
tagBoth(BlockTags.WOOL_CARPETS.location()); | ||
} | ||
|
||
@Override | ||
public Block createObject() { | ||
return new CarpetBlock(createProperties()); | ||
} | ||
|
||
@Override | ||
protected void generateBlockStateJson(VariantBlockStateGenerator bs) { | ||
var mod = newID("block/", "").toString(); | ||
bs.variant("", (v) -> v.model(mod)); | ||
} | ||
|
||
@Override | ||
protected void generateBlockModelJsons(AssetJsonGenerator generator) { | ||
var texture = textures.get("texture").getAsString(); | ||
|
||
generator.blockModel(id, m -> { | ||
m.parent("minecraft:block/carpet"); | ||
m.texture("wool", texture); | ||
}); | ||
} | ||
|
||
public CarpetBlockBuilder texture(String texture) { | ||
return (CarpetBlockBuilder) textureAll(texture); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters