Skip to content

Commit

Permalink
more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Aug 4, 2024
1 parent 395908d commit d4c68ff
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 408 deletions.
10 changes: 5 additions & 5 deletions src/main/java/net/id/paradiselost/ParadiseLost.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import net.fabricmc.api.*;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.id.paradiselost.blocks.ParadiseLostBlockSets;
import net.id.paradiselost.blocks.ParadiseLostBlocks;
import net.id.paradiselost.blocks.ParadiseLostWoodTypes;
import net.id.paradiselost.blocks.blockentity.ParadiseLostBlockEntityTypes;
import net.id.paradiselost.client.model.ParadiseLostModelLayers;
import net.id.paradiselost.client.model.ParadiseLostModelPredicates;
Expand All @@ -18,7 +20,6 @@
import net.id.paradiselost.commands.ParadiseLostCommands;
import net.id.paradiselost.entities.ParadiseLostEntityTypes;
import net.id.paradiselost.entities.passive.moa.MoaRaces;
import net.id.paradiselost.fluids.ParadiseLostFluids;
import net.id.paradiselost.items.ParadiseLostItems;
import net.id.paradiselost.lore.ParadiseLostLore;
import net.id.paradiselost.recipe.ParadiseLostRecipeTypes;
Expand All @@ -30,6 +31,7 @@
import net.id.paradiselost.world.dimension.ParadiseLostDimension;
import net.id.paradiselost.world.feature.ParadiseLostFeatures;
import net.id.paradiselost.world.gen.carver.ParadiseLostCarvers;
import net.minecraft.block.EnchantingTableBlock;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;

Expand Down Expand Up @@ -73,21 +75,20 @@ public static Identifier locate(String location) {

@Override
public void onInitialize() {
ParadiseLostConfig.init();
ParadiseLostRegistries.init();
ParadiseLostCarvers.init();
ParadiseLostFeatures.init();
ParadiseLostBiomes.init();
ParadiseLostDimension.init();
ParadiseLostBlockSets.init();
ParadiseLostWoodTypes.init();
ParadiseLostBlocks.init();
ParadiseLostFluids.init();
ParadiseLostEntityTypes.init();
ParadiseLostItems.init();
ParadiseLostBlockEntityTypes.init();
ParadiseLostRecipeTypes.init();
ParadiseLostCommands.init();
ParadiseLostGameRules.init();
ParadiseLostLootNumberProviderTypes.init();
ParadiseLostSoundEvents.init();
MoaRaces.init();
ParadiseLostScreens.init();
Expand All @@ -114,7 +115,6 @@ public void onInitializeClient() {
ParadiseLostBlockEntityRenderers.initClient();
ParadiseLostParticles.Client.init();
ParadiseLostTextures.initClient();
ParadiseLostBlocks.initClient();
ParadiseLostItemRenderers.initClient();
ParadiseLostScreens.initClient();
ParadiseLostScreens.clientInit();
Expand Down
45 changes: 24 additions & 21 deletions src/main/java/net/id/paradiselost/blocks/BlockRegistration.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ static class ParadiseLostStairsBlock extends StairsBlock {

// WOOD BLOCK SET

public static WoodBlockSet registerWoodBlockSet(String id, SaplingGenerator saplingGenerator, MapColor woodColor, MapColor barkColor, MapColor leafColor) {
public static WoodBlockSet registerWoodBlockSet(WoodType woodType, BlockSetType blockSetType, SaplingGenerator saplingGenerator, MapColor woodColor, MapColor barkColor, MapColor leafColor) {
var id = woodType.name();
return registerWoodBlockSet(
woodType, blockSetType,
id + "_sapling", "potted_" + id + "_sapling",
id + "_log", id + "_wood", "stripped_" + id + "_log", "stripped_" + id + "_wood",
id + "_leaves",
Expand All @@ -74,6 +76,7 @@ public static WoodBlockSet registerWoodBlockSetMotherAurel() {
var leavesSettings = AbstractBlock.Settings.copy(Blocks.OAK_LEAVES).mapColor(MapColor.GOLD).luminance(state -> 5);
SaplingBlock sapling = add(id + "_sapling", new ParadiseLostSaplingBlock(new MotherAurelSaplingGenerator(), saplingSettings));
return registerWoodBlockSet(
ParadiseLostWoodTypes.MOTHER_AUREL, ParadiseLostBlockSets.MOTHER_AUREL,
sapling,
add("potted_" + id + "_sapling", new FlowerPotBlock(sapling, flowerPotSettings)),
id + "_log", id + "_wood", "stripped_" + id + "_log", "stripped_" + id + "_wood",
Expand All @@ -91,6 +94,7 @@ public static WoodBlockSet registerWoodBlockSetOrange() {
var leavesSettings = AbstractBlock.Settings.copy(Blocks.OAK_LEAVES).mapColor(MapColor.PALE_GREEN).sounds(BlockSoundGroup.AZALEA_LEAVES);
FruitingLeavesBlock leaves = add(id + "_leaves", new FruitingLeavesBlock(leavesSettings, () -> ParadiseLostItems.ORANGE), flammableLeaves, cutoutMippedRenderLayer);
return registerWoodBlockSet(
ParadiseLostWoodTypes.ORANGE, ParadiseLostBlockSets.ORANGE,
id + "_sapling", "potted_" + id + "_sapling",
id + "_log", id + "_wood", "stripped_" + id + "_log", "stripped_" + id + "_wood",
leaves,
Expand All @@ -105,6 +109,7 @@ public static WoodBlockSet registerWoodBlockSetOrange() {
public static WoodBlockSet registerWoodBlockSetWisteria() {
String id = "wisteria";
return registerWoodBlockSet(
ParadiseLostWoodTypes.WISTERIA, ParadiseLostBlockSets.WISTERIA,
null, null,
id + "_log", id + "_wood", "stripped_" + id + "_log", "stripped_" + id + "_wood",
null,
Expand All @@ -117,6 +122,7 @@ public static WoodBlockSet registerWoodBlockSetWisteria() {
}

private static WoodBlockSet registerWoodBlockSet(
WoodType woodType, BlockSetType blockSetType,
String saplingId, String flowerPotId,
String logId, String woodId, String strippedLogId, String strippedWoodId,
String leavesId,
Expand Down Expand Up @@ -146,13 +152,14 @@ sapling, add(flowerPotId, new FlowerPotBlock(sapling, flowerPotSettings)),
add(logId, new PillarBlock(logSettings), flammableLog, stripsTo(strippedLog)), add(woodId, new PillarBlock(logSettings), flammableLog, stripsTo(strippedWood)), strippedLog, strippedWood,
add(leavesId, new LeavesBlock(leavesSettings), flammableLeaves, cutoutMippedRenderLayer),
planks, add(plankStairsId, new ParadiseLostStairsBlock(planks.getDefaultState(), plankSettings), flammablePlanks), add(plankSlabId, new SlabBlock(plankSettings), flammablePlanks),
add(fenceId, new FenceBlock(plankSettings), flammablePlanks), add(fenceGateId, new FenceGateBlock(plankSettings), flammablePlanks),
add(doorId, new DoorBlock(doorSettings), cutoutMippedRenderLayer), add(trapdoorId, new TrapdoorBlock(trapdoorSettings), cutoutMippedRenderLayer),
add(buttonId, new WoodenButtonBlock(buttonSettings)), add(pressurePlateId, new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, pressurePlateSettings))
add(fenceId, new FenceBlock(plankSettings), flammablePlanks), add(fenceGateId, new FenceGateBlock(plankSettings, woodType), flammablePlanks),
add(doorId, new DoorBlock(doorSettings, blockSetType), cutoutMippedRenderLayer), add(trapdoorId, new TrapdoorBlock(trapdoorSettings, blockSetType), cutoutMippedRenderLayer),
add(buttonId, new ButtonBlock(buttonSettings, blockSetType, 30, true)), add(pressurePlateId, new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, pressurePlateSettings, blockSetType))
);
}

private static WoodBlockSet registerWoodBlockSet(
WoodType woodType, BlockSetType blockSetType,
SaplingBlock sapling, FlowerPotBlock flowerPot,
String logId, String woodId, String strippedLogId, String strippedWoodId,
LeavesBlock leaves,
Expand All @@ -177,13 +184,14 @@ private static WoodBlockSet registerWoodBlockSet(
add(logId, new PillarBlock(logSettings), flammableLog, stripsTo(strippedLog)), add(woodId, new PillarBlock(logSettings), flammableLog, stripsTo(strippedWood)), strippedLog, strippedWood,
leaves,
planks, add(plankStairsId, new ParadiseLostStairsBlock(planks.getDefaultState(), plankSettings), flammablePlanks), add(plankSlabId, new SlabBlock(plankSettings), flammablePlanks),
add(fenceId, new FenceBlock(plankSettings), flammablePlanks), add(fenceGateId, new FenceGateBlock(plankSettings), flammablePlanks),
add(doorId, new DoorBlock(doorSettings), cutoutMippedRenderLayer), add(trapdoorId, new TrapdoorBlock(trapdoorSettings), cutoutMippedRenderLayer),
add(buttonId, new WoodenButtonBlock(buttonSettings)), add(pressurePlateId, new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, pressurePlateSettings))
add(fenceId, new FenceBlock(plankSettings), flammablePlanks), add(fenceGateId, new FenceGateBlock(plankSettings, woodType), flammablePlanks),
add(doorId, new DoorBlock(doorSettings, blockSetType), cutoutMippedRenderLayer), add(trapdoorId, new TrapdoorBlock(trapdoorSettings, blockSetType), cutoutMippedRenderLayer),
add(buttonId, new ButtonBlock(buttonSettings, blockSetType, 30, true)), add(pressurePlateId, new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, pressurePlateSettings, blockSetType))
);
}

private static WoodBlockSet registerWoodBlockSet(
WoodType woodType, BlockSetType blockSetType,
String saplingId, String flowerPotId,
String logId, String woodId, String strippedLogId, String strippedWoodId,
LeavesBlock leaves,
Expand Down Expand Up @@ -211,9 +219,9 @@ sapling, add(flowerPotId, new FlowerPotBlock(sapling, flowerPotSettings)),
add(logId, new PillarBlock(logSettings), flammableLog, stripsTo(strippedLog)), add(woodId, new PillarBlock(logSettings), flammableLog, stripsTo(strippedWood)), strippedLog, strippedWood,
leaves,
planks, add(plankStairsId, new ParadiseLostStairsBlock(planks.getDefaultState(), plankSettings), flammablePlanks), add(plankSlabId, new SlabBlock(plankSettings), flammablePlanks),
add(fenceId, new FenceBlock(plankSettings), flammablePlanks), add(fenceGateId, new FenceGateBlock(plankSettings), flammablePlanks),
add(doorId, new DoorBlock(doorSettings), cutoutMippedRenderLayer), add(trapdoorId, new TrapdoorBlock(trapdoorSettings), cutoutMippedRenderLayer),
add(buttonId, new ButtonBlock(buttonSettings)), add(pressurePlateId, new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, pressurePlateSettings))
add(fenceId, new FenceBlock(plankSettings), flammablePlanks), add(fenceGateId, new FenceGateBlock(plankSettings, woodType), flammablePlanks),
add(doorId, new DoorBlock(doorSettings, blockSetType), cutoutMippedRenderLayer), add(trapdoorId, new TrapdoorBlock(trapdoorSettings, blockSetType), cutoutMippedRenderLayer),
add(buttonId, new ButtonBlock(buttonSettings, blockSetType, 30, true)), add(pressurePlateId, new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, pressurePlateSettings, blockSetType))
);
}

Expand Down Expand Up @@ -258,25 +266,20 @@ public record SimpleBlockSet(

// SIGN SET

public static SignSet registerSignSet(String woodId) {
SignType signType = SignTypeAccessor.callRegister(new ParadiseLostSignType(MOD_ID + "_" + woodId));
public static SignSet registerSignSet(WoodType woodType) {

var signSettings = AbstractBlock.Settings.copy(Blocks.OAK_SIGN);

SignBlock signBlock = new SignBlock(signSettings, signType);
WallSignBlock wallSignBlock = new WallSignBlock(signSettings.dropsLike(signBlock), signType);
SignBlock signBlock = new SignBlock(signSettings, woodType);
WallSignBlock wallSignBlock = new WallSignBlock(signSettings.dropsLike(signBlock), woodType);

((BlockEntityTypeAccessor) BlockEntityType.SIGN).getBlocks().add(signBlock);
((BlockEntityTypeAccessor) BlockEntityType.SIGN).getBlocks().add(wallSignBlock);
add(woodType.name() + "_sign", signBlock);
add(woodType.name() + "_wall_sign", wallSignBlock);

add(woodId + "_sign", signBlock);
add(woodId + "_wall_sign", wallSignBlock);

return new SignSet(signType, signBlock, wallSignBlock);
return new SignSet(signBlock, wallSignBlock);
}

public record SignSet(
SignType type,
SignBlock sign,
WallSignBlock wallSign
) implements Iterable<Block> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package net.id.paradiselost.blocks;

import net.fabricmc.fabric.api.object.builder.v1.block.type.BlockSetTypeBuilder;
import net.id.paradiselost.ParadiseLost;
import net.minecraft.block.BlockSetType;

public class ParadiseLostBlockSets {
public static BlockSetType AUREL = BlockSetTypeBuilder.copyOf(BlockSetType.OAK).register(ParadiseLost.locate("aurel"));
public static BlockSetType MOTHER_AUREL = BlockSetTypeBuilder.copyOf(BlockSetType.OAK).register(ParadiseLost.locate("mother_aurel"));
public static BlockSetType ORANGE = BlockSetTypeBuilder.copyOf(BlockSetType.OAK).register(ParadiseLost.locate("orange"));
public static BlockSetType WISTERIA = BlockSetTypeBuilder.copyOf(BlockSetType.OAK).register(ParadiseLost.locate("wisteria"));

public static void init() {}
}
Loading

0 comments on commit d4c68ff

Please sign in to comment.