Patterns
This commit is contained in:
parent
0d5e6d544c
commit
f862bc8792
57 changed files with 493 additions and 225 deletions
|
@ -1,5 +1,6 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -9,14 +10,43 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.StairsBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.loot.context.LootContext;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
|
||||
public class BlockStairs extends StairsBlock {
|
||||
public class BlockStairs extends StairsBlock implements Patterned {
|
||||
|
||||
private final Block parent;
|
||||
|
||||
public BlockStairs(Block source) {
|
||||
super(source.getDefaultState(), FabricBlockSettings.copyOf(source));
|
||||
this.parent = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data, String block) {
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (block.contains("inner")) {
|
||||
return Patterned.createJson(Patterned.STAIRS_MODEL_INNER, parentId, block);
|
||||
}
|
||||
if (block.contains("outer")) {
|
||||
return Patterned.createJson(Patterned.STAIRS_MODEL_OUTER, parentId, block);
|
||||
}
|
||||
return Patterned.createJson(Patterned.STAIRS_MODEL, parentId, block);
|
||||
}
|
||||
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STAIRS_STATES_PATTERN;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue