Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import net.modificationstation.stationapi.api.event.registry.BlockRegistryEvent;
import net.modificationstation.stationapi.api.mod.entrypoint.EntrypointManager;
import net.modificationstation.stationapi.api.template.block.TemplateBlock;
import net.modificationstation.stationapi.api.template.block.TemplateLeavesBlock;
import net.modificationstation.stationapi.api.template.block.TemplateLogBlock;
import net.modificationstation.stationapi.api.util.Identifier;

import java.lang.invoke.MethodHandles;
Expand All @@ -25,7 +27,9 @@ public enum Blocks {
ALTAR("altar", "altar", id -> new BlockAltar(id, Material.STONE).setHardness(3)),
VARIATION_BLOCK("variation_block", "variationBlock", id -> new VariationBlock(id, Material.STONE).setHardness(.5F).setSoundGroup(Block.DEFAULT_SOUND_GROUP).disableAutoItemRegistration()),
EMISSION_CHECKER("emission_checker", "emissionChecker", LampBlock::new),
INDISPENSABLE_BLOCK("indispensable_block", "indispensableBlock", IndispensableBlock::new);
INDISPENSABLE_BLOCK("indispensable_block", "indispensableBlock", IndispensableBlock::new),
MODDED_LEAVES("modded_leaves", "moddedLeaves", id -> new TemplateLeavesBlock(id, 52)),
MODDED_LOG("modded_log", "moddedLog", TemplateLogBlock::new);

private final Runnable register;
private Block block;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package net.modificationstation.sltest.level.gen;

import net.mine_diver.unsafeevents.listener.EventListener;
import net.minecraft.block.Block;
import net.modificationstation.sltest.block.Blocks;
import net.modificationstation.stationapi.api.event.world.gen.WorldGenEvent;

public class ChunkListener {
Expand All @@ -11,5 +13,10 @@ public void populate(WorldGenEvent.ChunkDecoration event) {
// for (int z = 0; z < 16; z++)
// if ((event.biome == Biome.FOREST || event.biome == Biome.SEASONAL_FOREST) && event.random.nextBoolean())
// event.level.setTile(event.x + x, 90, event.z + z, BlockBase.DIAMOND_BLOCK.id);
// Modded leaves and log test
event.world.setBlock(event.x, 100, event.z, Blocks.MODDED_LOG.get().id);
// event.world.setBlock(event.x + 1, 100, event.z, Block.LEAVES.id);
// event.world.setBlock(event.x + 2, 100, event.z, Blocks.MODDED_LEAVES.get().id);
// event.world.setBlock(event.x + 3, 100, event.z, Block.LEAVES.id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
public final class BlockTags {
public static final TagKey<Block>
LOGS = of("logs"),
LEAVES = of("leaves"),
PLANKS = of("planks"),
INFINIBURN = of("infiniburn");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package net.modificationstation.stationapi.mixin.block;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.block.Block;
import net.minecraft.block.LeavesBlock;
import net.minecraft.world.World;
import net.modificationstation.stationapi.api.block.BlockState;
import net.modificationstation.stationapi.api.registry.tag.BlockTags;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(LeavesBlock.class)
public class LeavesBlockMixin {

@WrapOperation(method = "onTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getBlockId(III)I"))
private int makeModdedLogsAndLeavesWork(World instance, int x, int y, int z, Operation<Integer> original) {
BlockState state = instance.getBlockState(x, y, z);
if (state.isIn(BlockTags.LOGS)) {
return Block.LOG.id;
}
if (state.isIn(BlockTags.LEAVES)) {
return Block.LEAVES.id;
}

return original.call(instance, x, y, z);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"BlockItemMixin",
"BlockMixin",
"FireBlockMixin",
"LeavesBlockMixin",
"SecondaryBlockItemMixin",
"StatsMixin"
],
Expand Down