Added Behaviours for all relevant Blocks
This commit is contained in:
parent
3b2a2d4294
commit
6cb70dd35f
83 changed files with 1317 additions and 395 deletions
|
@ -1,5 +1,7 @@
|
|||
package org.betterx.bclib.blocks;
|
||||
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
|
||||
import org.betterx.bclib.interfaces.TagProvider;
|
||||
import org.betterx.worlds.together.tag.v3.MineableTags;
|
||||
import org.betterx.worlds.together.tag.v3.TagManager;
|
||||
|
||||
|
@ -7,9 +9,13 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.RotatedPillarBlock;
|
||||
|
@ -17,12 +23,14 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.material.MapColor;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BaseStripableLogBlock extends BaseRotatedPillarBlock {
|
||||
|
||||
public abstract class BaseStripableLogBlock extends BaseRotatedPillarBlock {
|
||||
private final Block striped;
|
||||
|
||||
public BaseStripableLogBlock(MapColor color, Block striped) {
|
||||
super(Properties.copy(striped).mapColor(color));
|
||||
protected BaseStripableLogBlock(Block striped, Properties settings) {
|
||||
super(settings);
|
||||
this.striped = striped;
|
||||
}
|
||||
|
||||
|
@ -53,4 +61,27 @@ public class BaseStripableLogBlock extends BaseRotatedPillarBlock {
|
|||
}
|
||||
return InteractionResult.FAIL;
|
||||
}
|
||||
|
||||
public static class Wood extends BaseStripableLogBlock implements BehaviourWood, TagProvider {
|
||||
private final boolean flammable;
|
||||
|
||||
public Wood(MapColor color, Block striped, boolean flammable) {
|
||||
super(
|
||||
striped,
|
||||
(flammable ? Properties.copy(striped).ignitedByLava() : Properties.copy(striped)).mapColor(color)
|
||||
);
|
||||
this.flammable = flammable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
|
||||
blockTags.add(BlockTags.LOGS);
|
||||
itemTags.add(ItemTags.LOGS);
|
||||
|
||||
if (flammable) {
|
||||
blockTags.add(BlockTags.LOGS_THAT_BURN);
|
||||
itemTags.add(ItemTags.LOGS_THAT_BURN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue