Skip to content

Commit

Permalink
fix?: mushroom item model, transparency
Browse files Browse the repository at this point in the history
  • Loading branch information
screret committed Jan 8, 2024
1 parent 0df69e1 commit f1f7d29
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ public class GCyRBlocks {
.block("prb_underground_mushroom", (p) -> new MushroomBlock(p, null /*todo fix*/))
.initialProperties(() -> Blocks.BROWN_MUSHROOM)
.properties(p -> p.mapColor(MapColor.COLOR_CYAN))
.addLayer(() -> RenderType::cutout)
.blockstate(GCyRModels::crossModel)
.item()
.defaultModel()
.model(GCyRModels::blockTextureGeneratedModel)
.build()
.register();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import argent_matter.gcyr.common.block.RocketMotorBlock;
import com.tterrag.registrate.providers.DataGenContext;
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
import com.tterrag.registrate.providers.RegistrateItemModelProvider;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.CarpetBlock;
import net.minecraft.world.level.block.DoorBlock;
import net.minecraft.world.level.block.RotatedPillarBlock;

public class GCyRModels {

Expand Down Expand Up @@ -42,4 +43,9 @@ public static void randomRotatedModel(DataGenContext<Block, ? extends Block> ctx
public static void crossModel(DataGenContext<Block, ? extends Block> ctx, RegistrateBlockstateProvider prov) {
throw new AssertionError();
}

@ExpectPlatform
public static void blockTextureGeneratedModel(DataGenContext<Item, ? extends Item> ctx, RegistrateItemModelProvider prov) {
throw new AssertionError();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import argent_matter.gcyr.common.block.RocketMotorBlock;
import com.tterrag.registrate.providers.DataGenContext;
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
import com.tterrag.registrate.providers.RegistrateItemModelProvider;
import io.github.fabricators_of_create.porting_lib.models.generators.ConfiguredModel;
import io.github.fabricators_of_create.porting_lib.models.generators.ModelFile;
import io.github.fabricators_of_create.porting_lib.models.generators.ModelProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.CarpetBlock;
import net.minecraft.world.level.block.DoorBlock;
Expand Down Expand Up @@ -58,4 +60,8 @@ public static void crossModel(DataGenContext<Block, ? extends Block> ctx, Regist
ModelFile cross = prov.models().cross(ctx.getName(), prov.blockTexture(block));
prov.simpleBlock(block, cross);
}

public static void blockTextureGeneratedModel(DataGenContext<Item, ? extends Item> ctx, RegistrateItemModelProvider prov) {
prov.generated(ctx::getEntry, prov.modLoc("block/" + ctx.getName()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import argent_matter.gcyr.common.block.RocketMotorBlock;
import com.tterrag.registrate.providers.DataGenContext;
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
import com.tterrag.registrate.providers.RegistrateItemModelProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.CarpetBlock;
import net.minecraft.world.level.block.DoorBlock;
Expand Down Expand Up @@ -58,4 +60,8 @@ public static void crossModel(DataGenContext<Block, ? extends Block> ctx, Regist
ModelFile cross = prov.models().cross(ctx.getName(), prov.blockTexture(block));
prov.simpleBlock(block, cross);
}

public static void blockTextureGeneratedModel(DataGenContext<Item, ? extends Item> ctx, RegistrateItemModelProvider prov) {
prov.generated(ctx::getEntry, prov.modLoc("block/" + ctx.getName()));
}
}

0 comments on commit f1f7d29

Please sign in to comment.