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

Commit

Permalink
Finish adding signs
Browse files Browse the repository at this point in the history
  • Loading branch information
CorgiTaco committed Jun 7, 2022
1 parent 6621588 commit 095ad63
Show file tree
Hide file tree
Showing 182 changed files with 1,410 additions and 17 deletions.
29 changes: 24 additions & 5 deletions Common/src/main/java/potionstudios/byg/BYG.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SignBlock;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.levelgen.carver.WorldCarver;
import net.minecraft.world.level.material.Material;
Expand All @@ -29,6 +30,7 @@
import potionstudios.byg.config.ConfigVersionTracker;
import potionstudios.byg.data.BYGDataProviders;
import potionstudios.byg.mixin.access.*;
import potionstudios.byg.reg.BlockRegistryObject;
import potionstudios.byg.reg.RegistryObject;
import potionstudios.byg.server.command.ReloadConfigsCommand;
import potionstudios.byg.server.command.UpdateConfigsCommand;
Expand Down Expand Up @@ -84,11 +86,8 @@ public static void threadSafeCommonLoad() {
BYGDataProviders.generateProviders();
}
BYGVillagerType.setVillagerForBYGBiomes();
BlockEntityTypeAccess builderAccess = (BlockEntityTypeAccess) BlockEntityType.CAMPFIRE;
Set<Block> validBlocks = new ObjectOpenHashSet<>(builderAccess.byg_getValidBlocks());
validBlocks.add(BYGBlocks.CRYPTIC_CAMPFIRE.get());
validBlocks.add(BYGBlocks.BORIC_CAMPFIRE.get());
builderAccess.byg_setValidBlocks(validBlocks);
appendBlocksToBlockEntities();

DeltaFeatureAccess.byg_setCANNOT_REPLACE(
new ImmutableList.Builder<Block>()
.addAll(DeltaFeatureAccess.byg_getCANNOT_REPLACE())
Expand All @@ -110,6 +109,26 @@ public static void threadSafeCommonLoad() {
);
}

private static void appendBlocksToBlockEntities() {
BlockEntityTypeAccess campfireBuilderAccess = (BlockEntityTypeAccess) BlockEntityType.CAMPFIRE;
Set<Block> validCampfireBlocks = new ObjectOpenHashSet<>(campfireBuilderAccess.byg_getValidBlocks());
validCampfireBlocks.add(BYGBlocks.CRYPTIC_CAMPFIRE.get());
validCampfireBlocks.add(BYGBlocks.BORIC_CAMPFIRE.get());
campfireBuilderAccess.byg_setValidBlocks(validCampfireBlocks);

BlockEntityTypeAccess signBuilderAccess = (BlockEntityTypeAccess) BlockEntityType.SIGN;
Set<Block> signValidBlocks = new ObjectOpenHashSet<>(signBuilderAccess.byg_getValidBlocks());
for (BlockRegistryObject<Block> signBlock : BYGBlocks.SIGN_BLOCKS) {
Block block = signBlock.get();
if (block instanceof SignBlock) {
signValidBlocks.add(block);
} else {
throw new IllegalArgumentException("Attempting to add block to sign block entity that is not a type of SignBlock");
}
}
signBuilderAccess.byg_setValidBlocks(signValidBlocks);
}

public static void threadSafeLoadFinish() {
LOGGER.debug("BYG: \"Load Complete Event\" Starting...");
BYGCompostables.compostablesBYG();
Expand Down
2 changes: 1 addition & 1 deletion Common/src/main/java/potionstudios/byg/BYGConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class BYGConstants {
public static final int EXPERIMENTAL_WARNING_VERSION = 5;
public static final int CONFIG_VERSION = 4;
public static final boolean BIOMEPEDIA = true;
public static final boolean SIGNS = false;
public static final boolean SIGNS = true;
public static final boolean DEV_ENVIRONMENT = Boolean.parseBoolean(System.getProperty("bygDev", "false"));
public static final boolean GENERATE_DATA = Boolean.parseBoolean(System.getProperty("bygGenerateData", "false"));
public static boolean ENABLE_OVERWORLD_TREES = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public static void renderTypes(Consumer<Map<Block, RenderType>> mapConsumer) {
map.put(BYGBlocks.POISON_IVY.get(), RenderType.cutoutMipped());
map.put(BYGBlocks.SKYRIS_VINE.get(), RenderType.cutoutMipped());

for (final var potBlock : BYGBlocks.flowerPotBlocks)
for (final var potBlock : BYGBlocks.FLOWER_POT_BLOCKS)
map.put(potBlock.get(), RenderType.cutoutMipped());

BYG.LOGGER.debug("BYG: Texture Cutouts Rendered!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
public class BYGBlocks {
public static final RegistrationProvider<Block> PROVIDER = RegistrationProvider.get(Registry.BLOCK_REGISTRY, BYG.MOD_ID);

public static List<BlockRegistryObject<Block>> flowerPotBlocks = new ArrayList<>();
public static final List<BlockRegistryObject<Block>> FLOWER_POT_BLOCKS = new ArrayList<>();
public static final List<BlockRegistryObject<Block>> SIGN_BLOCKS = new ArrayList<>();

public static final BlockRegistryObject<Block> ASPEN_PLANKS = createPlanks("aspen_planks");
public static final BlockRegistryObject<Block> BAOBAB_PLANKS = createPlanks("baobab_planks");
Expand Down Expand Up @@ -1731,7 +1732,7 @@ private static BlockRegistryObject<Block> createFloweringIndigoJacarandaBush(int
public static BlockRegistryObject<Block> createPottedBlock(Supplier<Block> blockForPot, String id) {
final var b = createBlock(blockForPot, id);
final BlockRegistryObject<Block> potted = createBlock(() -> BYGBlockFactory.INSTANCE.createPottedBlock(b, BlockBehaviour.Properties.of(Material.DECORATION).instabreak().noOcclusion()), "potted_" + id);
flowerPotBlocks.add(potted);
FLOWER_POT_BLOCKS.add(potted);
return b;
}

Expand Down Expand Up @@ -1840,15 +1841,19 @@ private static BlockRegistryObject<Block> createSign(String id, WoodType type, B
}

private static BlockRegistryObject<Block> createSign(String id, WoodType type, Supplier<? extends MaterialColor> color) {
return BYGConstants.SIGNS ? createBlock(() -> new StandingSignBlock(BlockBehaviour.Properties.copy(Blocks.OAK_SIGN).color(color.get()), type), id) : null;
BlockRegistryObject<Block> signBlock = BYGConstants.SIGNS ? createBlock(() -> new StandingSignBlock(BlockBehaviour.Properties.copy(Blocks.OAK_SIGN).color(color.get()), type), id) : null;
SIGN_BLOCKS.add(signBlock);
return signBlock;
}

private static BlockRegistryObject<Block> createWallSign(String id, WoodType type, BlockRegistryObject<Block> color) {
return createWallSign(id, type, () -> color.get().defaultMaterialColor());
}

private static BlockRegistryObject<Block> createWallSign(String id, WoodType type, Supplier<? extends MaterialColor> color) {
return BYGConstants.SIGNS ? createBlock(() -> new WallSignBlock(BlockBehaviour.Properties.copy(Blocks.OAK_SIGN).color(color.get()), type), id) : null;
BlockRegistryObject<Block> signBlock = BYGConstants.SIGNS ? createBlock(() -> new WallSignBlock(BlockBehaviour.Properties.copy(Blocks.OAK_SIGN).color(color.get()), type), id) : null;
SIGN_BLOCKS.add(signBlock);
return signBlock;
}

public static <B extends Block> BlockRegistryObject<B> createBlock(Supplier<? extends B> block, String id) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/aspen_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/aspen_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/baobab_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/baobab_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/blue_enchanted_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/blue_enchanted_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/bulbis_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/bulbis_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/cherry_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/cherry_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/cika_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/cika_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/cypress_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/cypress_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/ebony_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/ebony_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/embur_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/embur_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/ether_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/ether_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/fir_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/fir_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/green_enchanted_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/green_enchanted_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/holly_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/holly_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/imparius_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/imparius_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/jacaranda_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/jacaranda_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "byg:block/lament_sign"
}
}
}
Loading

0 comments on commit 095ad63

Please sign in to comment.