Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
additional helper methods on generator
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealEmissions committed Mar 28, 2024
1 parent 3f58295 commit f92fd0a
Showing 1 changed file with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,26 @@ public Generator multipartBuilder(@NotNull UnaryOperator<MultiPartBlockStateBuil
return this;
}

public ResourceLocation key() {
return ForgeRegistries.BLOCKS.getKey(block.get());
}

public String name() {
return key().getPath();
}

public ResourceLocation blockTexture() {
return provider.blockTexture(block.get());
}

public ResourceLocation extend(ResourceLocation rl, String suffix) {
return new ResourceLocation(rl.getNamespace(), rl.getPath() + suffix);
}

public ModelFile cubeAll() {
return provider.cubeAll(block.get());
}

public Generator simple() {
provider.simpleBlock(block.get());
return this;
Expand Down Expand Up @@ -74,7 +94,7 @@ public Generator simpleWithItem(ModelFile model) {

public Generator simpleWithItem() {
Block localBlock = block.get();
provider.simpleBlockWithItem(localBlock, provider.cubeAll(localBlock));
provider.simpleBlockWithItem(localBlock, cubeAll());
return this;
}

Expand Down Expand Up @@ -639,9 +659,4 @@ protected void registerStatesAndModels() {
stateBuilderOperator.apply(generator);
}
}

private void blockWithItem(@NotNull RegistryObject<Block> registryObject) {
Block block = registryObject.get();
simpleBlockWithItem(block, cubeAll(block));
}
}

0 comments on commit f92fd0a

Please sign in to comment.