Skip to content

Commit

Permalink
thatch and nests
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Nov 19, 2024
1 parent 24039c0 commit 7eb86f7
Show file tree
Hide file tree
Showing 38 changed files with 527 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ private static Settings permafrost() {
public static final Block LIVERWORT = add("liverwort", new Block(copy(MOSS_BLOCK).sounds(BlockSoundGroup.AZALEA_LEAVES)));
public static final CarpetBlock LIVERWORT_CARPET = add("liverwort_carpet", new CarpetBlock(copy(MOSS_BLOCK).sounds(BlockSoundGroup.AZALEA_LEAVES)));

public static final SimpleBlockSet THATCH_SET = registerSimpleBlockSet("thatch", create().mapColor(MapColor.PALE_YELLOW).strength(0.3f).sounds(BlockSoundGroup.GRASS));


// Clouds
private static Settings cloud() {
Expand Down Expand Up @@ -282,6 +284,7 @@ private static Settings cherineTorch() {

// Usables
public static final IncubatorBlock INCUBATOR = add("incubator", new IncubatorBlock(create().mapColor(MapColor.DULL_RED).strength(2.5f).sounds(BlockSoundGroup.WOOD).nonOpaque()), cutoutMippedRenderLayer);
public static final IncubatorBlock NEST = add("nest", new IncubatorBlock(create().mapColor(MapColor.PALE_YELLOW).strength(0.3f).sounds(BlockSoundGroup.GRASS).nonOpaque(), 0.35F), cutoutMippedRenderLayer);
public static final FoodBowlBlock FOOD_BOWL = add("food_bowl", new FoodBowlBlock(create().mapColor(MapColor.DULL_RED).strength(2.5f).sounds(BlockSoundGroup.WOOD).nonOpaque()), cutoutMippedRenderLayer);
public static final Block TREE_TAP = add("tree_tap", new TreeTapBlock(create().mapColor(MapColor.SPRUCE_BROWN).strength(2.5f).sounds(BlockSoundGroup.WOOD).nonOpaque().ticksRandomly()), cutoutRenderLayer);
public static final NitraBlock NITRA_BUNCH = add("nitra_bunch", new NitraBlock(create().mapColor(MapColor.PALE_YELLOW).strength(0.5f).sounds(BlockSoundGroup.WET_GRASS)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,23 @@ public class IncubatorBlockEntity extends BlockEntity {
private UUID owner;
private int hatchTicks = 100;
private ItemStack egg;
private float offsetHeight;

public IncubatorBlockEntity(BlockPos pos, BlockState state, float offsetHeight) {
super(ParadiseLostBlockEntityTypes.INCUBATOR, pos, state);
this.egg = ItemStack.EMPTY;
this.offsetHeight = offsetHeight;
}

public IncubatorBlockEntity(BlockPos pos, BlockState state) {
super(ParadiseLostBlockEntityTypes.INCUBATOR, pos, state);
this.egg = ItemStack.EMPTY;
this.offsetHeight = 0.55F;
}

public static <T extends BlockEntity> void tickServer(World world, BlockPos pos, BlockState state, T entity) {
IncubatorBlockEntity incubator = (IncubatorBlockEntity) entity;
if (incubator.egg.getItem() == ParadiseLostItems.MOA_EGG) {

if (world.getTime() % 10 == 0) {
if (world.getBlockState(pos.up(2)).isIn(INCUBATOR_WARMER_LIGHTS) || world.getBlockState(pos.up(1)).isIn(INCUBATOR_WARMER_LIGHTS)) { //Split tags, think I did it right
incubator.hatchTicks -= 2;
Expand All @@ -57,12 +64,13 @@ public static <T extends BlockEntity> void tickServer(World world, BlockPos pos,
world.playSound(null, pos, ParadiseLostSoundEvents.ENTITY_MOA_EGG_HATCH, SoundCategory.BLOCKS, 0.8F, 0.5F);
world.spawnEntity(moa);
incubator.egg = ItemStack.EMPTY;
incubator.markDirty();
}
incubator.markDirty();
}
}

public void handleUse(PlayerEntity player, Hand hand, ItemStack handStack) {
markDirty();
owner = player.getUuid();
ItemStack stored = egg.copy();
egg = handStack.copy();
Expand All @@ -77,6 +85,9 @@ public boolean hasItem() {
public ItemStack getItem() {
return egg;
}
public float getOffsetHeight() {
return offsetHeight;
}

@Override
public void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class ParadiseLostBlockEntityTypes {
public static final BlockEntityType<FoodBowlBlockEntity> FOOD_BOWL = create(FoodBowlBlockEntity::new, ParadiseLostBlocks.FOOD_BOWL).build();
public static final BlockEntityType<IncubatorBlockEntity> INCUBATOR = create(IncubatorBlockEntity::new, ParadiseLostBlocks.INCUBATOR).build();
public static final BlockEntityType<IncubatorBlockEntity> INCUBATOR = create(IncubatorBlockEntity::new, ParadiseLostBlocks.INCUBATOR, ParadiseLostBlocks.NEST).build();
public static final BlockEntityType<CherineCampfireBlockEntity> CHERINE_CAMPFIRE = create(CherineCampfireBlockEntity::new, ParadiseLostBlocks.CHERINE_CAMPFIRE).build();
public static final BlockEntityType<TreeTapBlockEntity> TREE_TAP = create(TreeTapBlockEntity::new, ParadiseLostBlocks.TREE_TAP).build();
public static final BlockEntityType<ParadiseSignBlockEntity> SIGN = create(ParadiseSignBlockEntity::new,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ public class IncubatorBlock extends ParadiseLostBlockWithEntity {

public static final MapCodec<IncubatorBlock> CODEC = createCodec(IncubatorBlock::new);
private static final VoxelShape SHAPE = Block.createCuboidShape(0, 0, 0, 16, 5, 16);
private float offsetHeight;

public IncubatorBlock(Settings settings) {
super(settings, true);
this.offsetHeight = 0.55F;
}

public IncubatorBlock(Settings settings, float offsetHeight) {
super(settings, true);
this.offsetHeight = offsetHeight;
}

@Override
Expand Down Expand Up @@ -57,6 +64,6 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po
@Nullable
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new IncubatorBlockEntity(pos, state);
return new IncubatorBlockEntity(pos, state, this.offsetHeight);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public void render(IncubatorBlockEntity entity, float tickDelta, MatrixStack mat
if (entity.hasItem()) {
if (isMoaEggInIncubator(entity)) {
matrices.push();
matrices.translate(0.5, 0.55, 0.5);
matrices.translate(0.5, entity.getOffsetHeight(), 0.5);
matrices.scale(1F, 1F, 5F); //Thick egg
MinecraftClient.getInstance().getItemRenderer().renderItem(entity.getItem(), ModelTransformationMode.FIXED, light, overlay, matrices, vertexConsumers, null, 0);
matrices.pop();
}
else {
matrices.push();
matrices.translate(0.5, 0.55, 0.5);
matrices.translate(0.5, entity.getOffsetHeight(), 0.5);
matrices.scale(0.9F, 0.9F, 0.9F);
MinecraftClient.getInstance().getItemRenderer().renderItem(entity.getItem(), ModelTransformationMode.FIXED, light, overlay, matrices, vertexConsumers, null, 0);
matrices.pop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public class ParadiseLostItemGroups {
entries.add(WISTERIA_TRAPDOOR);
entries.add(WISTERIA_PRESSURE_PLATE);
entries.add(WISTERIA_BUTTON);
entries.add(THATCH_BLOCK);
entries.add(THATCH_STAIRS);
entries.add(THATCH_SLAB);
// Stone / stonelike
entries.add(FLOESTONE);
entries.add(FLOESTONE_STAIRS);
Expand Down Expand Up @@ -140,6 +143,9 @@ public class ParadiseLostItemGroups {
entries.add(LIVERWORT);
entries.add(LIVERWORT_CARPET);
entries.add(LEVITA);
entries.add(THATCH_BLOCK);
entries.add(THATCH_STAIRS);
entries.add(THATCH_SLAB);
// "packed" blocks
entries.add(PACKED_SWEDROOT);
entries.add(AMADRYS_BUNDLE);
Expand Down Expand Up @@ -218,6 +224,7 @@ public class ParadiseLostItemGroups {
entries.add(LEVITATOR);
entries.add(LEVITA_RAIL);
entries.add(INCUBATOR);
entries.add(NEST);
entries.add(FOOD_BOWL);
entries.add(TREE_TAP);
entries.add(AUREL_SIGN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ private static Settings food(FoodComponent foodComponent) {
public static final BlockItem LIVERWORT = add(ParadiseLostBlocks.LIVERWORT, compostable100, fuel(150));
public static final BlockItem LIVERWORT_CARPET = add(ParadiseLostBlocks.LIVERWORT_CARPET, compostable65, fuel(100));

public static final BlockItem THATCH_BLOCK = add(ParadiseLostBlocks.THATCH_SET.block(), compostable15, fuel(100));
public static final BlockItem THATCH_STAIRS = add(ParadiseLostBlocks.THATCH_SET.stairs(), compostable15, fuel(100));
public static final BlockItem THATCH_SLAB = add(ParadiseLostBlocks.THATCH_SET.slab(), compostable15, fuel(50));

public static final BlockItem ROOTCAP = add(ParadiseLostBlocks.ROOTCAP, compostable65);
public static final BlockItem BROWN_SPORECAP = add(ParadiseLostBlocks.BROWN_SPORECAP, compostable65);
public static final BlockItem PINK_SPORECAP = add(ParadiseLostBlocks.PINK_SPORECAP, compostable65);
Expand All @@ -391,6 +395,7 @@ private static Settings food(FoodComponent foodComponent) {
// util blocks (enchanter, freezer, etc.)
public static final BlockItem CHERINE_CAMPFIRE = add(ParadiseLostBlocks.CHERINE_CAMPFIRE);
public static final BlockItem INCUBATOR = add(ParadiseLostBlocks.INCUBATOR, fuel(300));
public static final BlockItem NEST = add(ParadiseLostBlocks.NEST, fuel(300));
public static final BlockItem FOOD_BOWL = add(ParadiseLostBlocks.FOOD_BOWL, fuel(300));
public static final BlockItem TREE_TAP = add(ParadiseLostBlocks.TREE_TAP, fuel(300));

Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/asset_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def generate_slab_block(block_id, base_block_id, texture):



generate_slab_block("flaxweave_cushion_slab", "flaxweave_cushion_double_slab", "flaxweave_cushion")

generate_standard_block("thatch")
generate_stairs_block("thatch_stairs", "thatch")
generate_slab_block("thatch_slab", "thatch", "thatch")
generate_standard_block("nest")


7 changes: 7 additions & 0 deletions src/main/resources/assets/paradise_lost/blockstates/nest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "paradise_lost:block/nest"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "paradise_lost:block/thatch"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"variants": {
"type=bottom": {
"model": "paradise_lost:block/thatch_slab"
},
"type=double": {
"model": "paradise_lost:block/thatch"
},
"type=top": {
"model": "paradise_lost:block/thatch_slab_top"
}
}
}
Loading

0 comments on commit 7eb86f7

Please sign in to comment.