Trapdoor pattern
This commit is contained in:
parent
7d0363483c
commit
24ec8637e7
4 changed files with 122 additions and 5 deletions
|
@ -1,18 +1,25 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.TrapdoorBlock;
|
||||
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.client.ERenderLayer;
|
||||
import ru.betterend.client.IRenderTypeable;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
|
||||
public class BlockTrapdoor extends TrapdoorBlock implements IRenderTypeable {
|
||||
public class BlockTrapdoor extends TrapdoorBlock implements IRenderTypeable, Patterned {
|
||||
public BlockTrapdoor(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source).nonOpaque());
|
||||
}
|
||||
|
@ -26,4 +33,28 @@ public class BlockTrapdoor extends TrapdoorBlock implements IRenderTypeable {
|
|||
public ERenderLayer getRenderLayer() {
|
||||
return ERenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data, String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
String name = blockId.getPath();
|
||||
return Patterned.createJson(Patterned.TRAPDOOR_MODEL, new HashMap<String, String>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
{
|
||||
put("%block%", name);
|
||||
put("%texture%", name.replace("trapdoor", "door_side"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.TRAPDOOR_STATES_PATTERN;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue