Some Backporting
This commit is contained in:
parent
d799050eb2
commit
54c2701153
11 changed files with 37 additions and 57 deletions
|
@ -67,27 +67,20 @@ public class BehaviourBuilders {
|
|||
.color(color)
|
||||
.noCollission()
|
||||
.strength(1.0f);
|
||||
if (flammable) {
|
||||
p.ignitedByLava();
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
public static BlockBehaviour.Properties createWallSign(MapColor color, Block dropBlock, boolean flammable) {
|
||||
return createSign(color, flammable).dropsLike(dropBlock);
|
||||
public static BlockBehaviour.Properties createWallSign(MaterialColor color, Block dropBlock, boolean flammable) {
|
||||
return createSign(color).dropsLike(dropBlock);
|
||||
}
|
||||
|
||||
public static BlockBehaviour.Properties createTrapDoor(MapColor color, boolean flammable) {
|
||||
public static BlockBehaviour.Properties createTrapDoor(MaterialColor color, boolean flammable) {
|
||||
final BlockBehaviour.Properties p = BlockBehaviour.Properties
|
||||
.of()
|
||||
.mapColor(color)
|
||||
.instrument(NoteBlockInstrument.BASS)
|
||||
.of(Material.WOOD)
|
||||
.color(color)
|
||||
.strength(3.0F)
|
||||
.noOcclusion()
|
||||
.isValidSpawn(Blocks::never);
|
||||
if (flammable) {
|
||||
p.ignitedByLava();
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,16 +5,14 @@ import org.betterx.bclib.behaviours.interfaces.*;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.state.properties.BlockSetType;
|
||||
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BehaviourHelper {
|
||||
public static boolean isStone(Block source) {
|
||||
return source instanceof BehaviourStone || source.defaultBlockState()
|
||||
.instrument()
|
||||
.equals(NoteBlockInstrument.BASEDRUM);
|
||||
return source instanceof BehaviourStone || source.defaultBlockState().getMaterial() == Material.STONE;
|
||||
}
|
||||
|
||||
public static boolean isStone(BlockSetType type) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public abstract class BaseBarkBlock extends BaseRotatedPillarBlock {
|
|||
private final boolean flammable;
|
||||
|
||||
public Wood(Properties settings, boolean flammable) {
|
||||
super(flammable ? settings.ignitedByLava() : settings);
|
||||
super(settings);
|
||||
this.flammable = flammable;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,14 +146,6 @@ public abstract class BaseButtonBlock extends ButtonBlock implements BlockModelP
|
|||
public Stone(Block source, BlockSetType type) {
|
||||
super(source, Properties.copy(source).noOcclusion(), false, type);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
|
||||
super.addTags(blockTags, itemTags);
|
||||
blockTags.add(BlockTags.STONE_BUTTONS);
|
||||
itemTags.add(ItemTags.STONE_BUTTONS);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Wood extends BaseButtonBlock implements BehaviourWood {
|
||||
|
|
|
@ -74,7 +74,7 @@ public abstract class BaseRotatedPillarBlock extends RotatedPillarBlock implemen
|
|||
protected final boolean flammable;
|
||||
|
||||
public Wood(Properties settings, boolean flammable) {
|
||||
super(flammable ? settings.ignitedByLava() : settings);
|
||||
super(settings);
|
||||
this.flammable = flammable;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,12 +65,10 @@ public abstract class BaseStripableBarkBlock extends BaseBarkBlock {
|
|||
public static class Wood extends BaseStripableBarkBlock implements BehaviourWood, TagProvider {
|
||||
private final boolean flammable;
|
||||
|
||||
public Wood(MapColor color, Block stripedBlock, boolean flammable) {
|
||||
public Wood(MaterialColor color, Block stripedBlock, boolean flammable) {
|
||||
super(
|
||||
stripedBlock,
|
||||
(flammable
|
||||
? Properties.copy(stripedBlock).ignitedByLava()
|
||||
: Properties.copy(stripedBlock)).mapColor(color)
|
||||
Properties.copy(stripedBlock).color(color)
|
||||
);
|
||||
this.flammable = flammable;
|
||||
}
|
||||
|
|
|
@ -65,10 +65,10 @@ public abstract class BaseStripableLogBlock extends BaseRotatedPillarBlock {
|
|||
public static class Wood extends BaseStripableLogBlock implements BehaviourWood, TagProvider {
|
||||
private final boolean flammable;
|
||||
|
||||
public Wood(MapColor color, Block striped, boolean flammable) {
|
||||
public Wood(MaterialColor color, Block striped, boolean flammable) {
|
||||
super(
|
||||
striped,
|
||||
(flammable ? Properties.copy(striped).ignitedByLava() : Properties.copy(striped)).mapColor(color)
|
||||
Properties.copy(striped).color(color)
|
||||
);
|
||||
this.flammable = flammable;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,10 @@ public abstract class BaseTrapdoorBlock extends TrapDoorBlock implements RenderL
|
|||
|
||||
public static class Wood extends BaseTrapdoorBlock implements BehaviourWood {
|
||||
public Wood(Block source, BlockSetType type, boolean flammable) {
|
||||
this(BehaviourBuilders.createTrapDoor(source.defaultMapColor(), flammable).sound(SoundType.WOOD), type);
|
||||
this(
|
||||
BehaviourBuilders.createTrapDoor(source.defaultMaterialColor(), flammable).sound(SoundType.WOOD),
|
||||
type
|
||||
);
|
||||
}
|
||||
|
||||
public Wood(Properties properties, BlockSetType type) {
|
||||
|
@ -136,7 +139,7 @@ public abstract class BaseTrapdoorBlock extends TrapDoorBlock implements RenderL
|
|||
|
||||
public static class Stone extends BaseTrapdoorBlock implements BehaviourStone {
|
||||
public Stone(Block source, BlockSetType type) {
|
||||
this(BehaviourBuilders.createTrapDoor(source.defaultMapColor(), false).sound(SoundType.STONE), type);
|
||||
this(BehaviourBuilders.createTrapDoor(source.defaultMaterialColor(), false).sound(SoundType.STONE), type);
|
||||
}
|
||||
|
||||
public Stone(Properties properties, BlockSetType type) {
|
||||
|
@ -146,7 +149,7 @@ public abstract class BaseTrapdoorBlock extends TrapDoorBlock implements RenderL
|
|||
|
||||
public static class Metal extends BaseTrapdoorBlock implements BehaviourMetal {
|
||||
public Metal(Block source, BlockSetType type) {
|
||||
this(BehaviourBuilders.createTrapDoor(source.defaultMapColor(), false).sound(SoundType.METAL), type);
|
||||
this(BehaviourBuilders.createTrapDoor(source.defaultMaterialColor(), false).sound(SoundType.METAL), type);
|
||||
}
|
||||
|
||||
public Metal(Properties properties, BlockSetType type) {
|
||||
|
|
|
@ -29,14 +29,9 @@ public abstract class BaseHangingSignBlock extends CeilingHangingSignBlock imple
|
|||
BaseWallHangingSignBlock create(Properties properties, WoodType woodType);
|
||||
}
|
||||
|
||||
protected BaseHangingSignBlock(WoodType type, MapColor color, boolean flammable, WallSignProvider provider) {
|
||||
super(BehaviourBuilders.createSign(color, flammable), type);
|
||||
this.wallSign = provider.create(BehaviourBuilders.createWallSign(color, this, flammable), type);
|
||||
}
|
||||
|
||||
public BaseHangingSignBlock(WoodType type, MaterialColor color) {
|
||||
protected BaseHangingSignBlock(WoodType type, MaterialColor color, boolean flammable, WallSignProvider provider) {
|
||||
super(BehaviourBuilders.createSign(color), type);
|
||||
this.wallSign = new BaseWallHangingSignBlock(BehaviourBuilders.createWallSign(color, this), type);
|
||||
this.wallSign = provider.create(BehaviourBuilders.createWallSign(color, this, flammable), type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,14 +47,14 @@ public abstract class BaseHangingSignBlock extends CeilingHangingSignBlock imple
|
|||
|
||||
public static class Wood extends BaseHangingSignBlock implements BehaviourWood {
|
||||
public Wood(WoodType type) {
|
||||
this(type, MapColor.WOOD, true);
|
||||
this(type, MaterialColor.WOOD, true);
|
||||
}
|
||||
|
||||
public Wood(BCLWoodTypeWrapper type) {
|
||||
this(type.type, type.color, type.flammable);
|
||||
}
|
||||
|
||||
public Wood(WoodType type, MapColor color, boolean flammable) {
|
||||
public Wood(WoodType type, MaterialColor color, boolean flammable) {
|
||||
super(type, color, flammable, BaseWallHangingSignBlock.Wood::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@ import net.minecraft.world.item.Item;
|
|||
import net.minecraft.world.item.SignItem;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.StandingSignBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.RotationSegment;
|
||||
import net.minecraft.world.level.block.state.properties.WoodType;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
|
||||
|
@ -33,13 +31,8 @@ public abstract class BaseSignBlock extends StandingSignBlock implements BlockMo
|
|||
}
|
||||
|
||||
protected BaseSignBlock(WoodType type, MaterialColor color, boolean flammable, WallSignProvider provider) {
|
||||
super(BehaviourBuilders.createSign(color, flammable), type);
|
||||
this.wallSign = provider.create(BehaviourBuilders.createWallSign(color, this, flammable), type);
|
||||
}
|
||||
|
||||
public BaseSignBlock(WoodType type, MaterialColor color) {
|
||||
super(BehaviourBuilders.createSign(color), type);
|
||||
this.wallSign = new BaseWallSignBlock(BehaviourBuilders.createWallSign(color, this), type);
|
||||
this.wallSign = provider.create(BehaviourBuilders.createWallSign(color, this, flammable), type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,14 +48,14 @@ public abstract class BaseSignBlock extends StandingSignBlock implements BlockMo
|
|||
|
||||
public static class Wood extends BaseSignBlock implements BehaviourWood {
|
||||
public Wood(WoodType type) {
|
||||
this(type, MapColor.WOOD, true);
|
||||
this(type, MaterialColor.WOOD, true);
|
||||
}
|
||||
|
||||
public Wood(BCLWoodTypeWrapper type) {
|
||||
this(type.type, type.color, type.flammable);
|
||||
}
|
||||
|
||||
public Wood(WoodType type, MapColor color, boolean flammable) {
|
||||
public Wood(WoodType type, MaterialColor color, boolean flammable) {
|
||||
super(type, color, flammable, BaseWallSignBlock.Wood::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,11 +14,13 @@ public final class BCLWoodTypeWrapper {
|
|||
public final ResourceLocation id;
|
||||
public final WoodType type;
|
||||
public final MaterialColor color;
|
||||
public final boolean flammable;
|
||||
|
||||
protected BCLWoodTypeWrapper(ResourceLocation id, WoodType type, MaterialColor color) {
|
||||
protected BCLWoodTypeWrapper(ResourceLocation id, WoodType type, MaterialColor color, boolean flammable) {
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
this.color = color;
|
||||
this.flammable = flammable;
|
||||
}
|
||||
|
||||
public static Builder create(String modID, String string) {
|
||||
|
@ -73,6 +75,7 @@ public final class BCLWoodTypeWrapper {
|
|||
private final ResourceLocation id;
|
||||
private BlockSetType setType;
|
||||
private MaterialColor color;
|
||||
private boolean flammable;
|
||||
|
||||
public Builder(ResourceLocation id) {
|
||||
this.id = id;
|
||||
|
@ -89,11 +92,16 @@ public final class BCLWoodTypeWrapper {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder setFlammable(boolean v) {
|
||||
this.flammable = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BCLWoodTypeWrapper build() {
|
||||
if (setType == null) setType = BlockSetTypeRegistry.registerWood(id);
|
||||
|
||||
final WoodType type = WoodTypeRegistry.register(id, setType);
|
||||
return new BCLWoodTypeWrapper(id, type, color);
|
||||
return new BCLWoodTypeWrapper(id, type, color, flammable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue