Item model patterns
This commit is contained in:
parent
73a0cb890c
commit
d9a60fc7f2
15 changed files with 48 additions and 50 deletions
|
@ -46,7 +46,7 @@ public class BlockDoor extends DoorBlock implements IRenderTypeable, BlockPatter
|
|||
public String getModelPattern(String block) {
|
||||
String blockId = Registry.BLOCK.getId(this).getPath();
|
||||
if (block.contains("item")) {
|
||||
return Patterns.createJson(Patterns.ITEM_MODEL, blockId);
|
||||
return Patterns.createJson(Patterns.ITEM_GENERATED, block);
|
||||
}
|
||||
if (block.contains("top_hinge")) {
|
||||
return Patterns.createJson(Patterns.BLOCK_DOOR_TOP_HINGE, blockId, blockId);
|
||||
|
|
|
@ -160,10 +160,9 @@ public class BlockSign extends AbstractSignBlock implements BlockPatterned {
|
|||
|
||||
@Override
|
||||
public String getModelPattern(String path) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (path.contains("item")) {
|
||||
return Patterns.createJson(Patterns.ITEM_MODEL, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.ITEM_GENERATED, path);
|
||||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_EMPTY, parentId.getPath());
|
||||
}
|
||||
|
|
|
@ -9,8 +9,10 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.tag.Tag;
|
||||
import ru.betterend.patterns.Patterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class EndAxe extends AxeItem implements DynamicAttributeTool {
|
||||
public class EndAxe extends AxeItem implements DynamicAttributeTool, Patterned {
|
||||
|
||||
public EndAxe(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) {
|
||||
super(material, attackDamage, attackSpeed, settings);
|
||||
|
@ -23,4 +25,9 @@ public class EndAxe extends AxeItem implements DynamicAttributeTool {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String name) {
|
||||
return Patterns.createJson(Patterns.ITEM_HANDHELD, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,11 @@ import net.minecraft.tag.Tag;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import ru.betterend.patterns.Patterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
||||
public class EndHammer extends MiningToolItem implements DynamicAttributeTool {
|
||||
public class EndHammer extends MiningToolItem implements DynamicAttributeTool, Patterned {
|
||||
|
||||
public final static UUID ATTACK_KNOCKBACK_MODIFIER_ID = MathHelper.randomUuid(ThreadLocalRandom.current());
|
||||
|
||||
|
@ -132,4 +134,9 @@ public class EndHammer extends MiningToolItem implements DynamicAttributeTool {
|
|||
public Multimap<EntityAttribute, EntityAttributeModifier> getAttributeModifiers(EquipmentSlot slot) {
|
||||
return slot == EquipmentSlot.MAINHAND ? this.attributeModifiers : super.getAttributeModifiers(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String name) {
|
||||
return Patterns.createJson(Patterns.ITEM_HANDHELD, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,17 @@ package ru.betterend.item;
|
|||
|
||||
import net.minecraft.item.HoeItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import ru.betterend.patterns.Patterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class EndHoe extends HoeItem {
|
||||
public class EndHoe extends HoeItem implements Patterned {
|
||||
|
||||
public EndHoe(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
|
||||
super(material, attackDamage, attackSpeed, settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String name) {
|
||||
return Patterns.createJson(Patterns.ITEM_HANDHELD, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,10 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.PickaxeItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.tag.Tag;
|
||||
import ru.betterend.patterns.Patterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class EndPickaxe extends PickaxeItem implements DynamicAttributeTool {
|
||||
public class EndPickaxe extends PickaxeItem implements DynamicAttributeTool, Patterned {
|
||||
|
||||
public EndPickaxe(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
|
||||
super(material, attackDamage, attackSpeed, settings);
|
||||
|
@ -23,4 +25,9 @@ public class EndPickaxe extends PickaxeItem implements DynamicAttributeTool {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String name) {
|
||||
return Patterns.createJson(Patterns.ITEM_HANDHELD, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,8 @@ public class Patterns {
|
|||
public final static Identifier ITEM_BUTTON = BetterEnd.makeID("patterns/item/pattern_button.json");
|
||||
public final static Identifier ITEM_CHEST = BetterEnd.makeID("patterns/item/pattern_chest.json");
|
||||
public final static Identifier ITEM_BLOCK = BetterEnd.makeID("patterns/item/pattern_block_item.json");
|
||||
public final static Identifier ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_item.json");
|
||||
public final static Identifier ITEM_GENERATED = BetterEnd.makeID("patterns/item/pattern_item_generated.json");
|
||||
public final static Identifier ITEM_HANDHELD = BetterEnd.makeID("patterns/item/pattern_item_handheld.json");
|
||||
|
||||
public static String createJson(Reader data, String parent, String block) {
|
||||
try (BufferedReader buffer = new BufferedReader(data)) {
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/aeternium_axe"
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/aeternium_hoe"
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/aeternium_pickaxe"
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/terminite_axe"
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/terminite_hoe"
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/terminite_pickaxe"
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/%texture%"
|
||||
"layer0": "betterend:%texture%"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/handheld",
|
||||
"textures": {
|
||||
"layer0": "betterend:%texture%"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue