Anvil states & new textures
|
@ -6,15 +6,18 @@ import net.minecraft.state.property.IntProperty;
|
|||
import net.minecraft.util.StringIdentifiable;
|
||||
|
||||
public class BlockProperties {
|
||||
public static final EnumProperty<TripleShape> TRIPLE_SHAPE = EnumProperty.of("shape", TripleShape.class);
|
||||
public final static EnumProperty<PedestalState> PEDESTAL_STATE = EnumProperty.of("state", PedestalState.class);
|
||||
public static final EnumProperty<HydraluxShape> HYDRALUX_SHAPE = EnumProperty.of("shape", HydraluxShape.class);
|
||||
public final static EnumProperty<PedestalState> PEDESTAL_STATE = EnumProperty.of("state", PedestalState.class);
|
||||
public static final EnumProperty<TripleShape> TRIPLE_SHAPE = EnumProperty.of("shape", TripleShape.class);
|
||||
public static final EnumProperty<PentaShape> PENTA_SHAPE = EnumProperty.of("shape", PentaShape.class);
|
||||
public static final BooleanProperty HAS_ITEM = BooleanProperty.of("has_item");
|
||||
|
||||
public static final BooleanProperty HAS_LIGHT = BooleanProperty.of("has_light");
|
||||
public static final BooleanProperty ACTIVE = BooleanProperty.of("active");
|
||||
public static final IntProperty ROTATION = IntProperty.of("rotation", 0, 3);
|
||||
public static final BooleanProperty HAS_ITEM = BooleanProperty.of("has_item");
|
||||
public static final BooleanProperty NATURAL = BooleanProperty.of("natural");
|
||||
public static final BooleanProperty ACTIVE = BooleanProperty.of("active");
|
||||
|
||||
public static final IntProperty DESTRUCTION = IntProperty.of("destruction", 0, 2);
|
||||
public static final IntProperty ROTATION = IntProperty.of("rotation", 0, 3);
|
||||
public static final IntProperty FULLNESS = IntProperty.of("fullness", 0, 3);
|
||||
public static final IntProperty COLOR = IntProperty.of("color", 0, 7);
|
||||
|
||||
|
|
|
@ -3,24 +3,39 @@ package ru.betterend.blocks.basis;
|
|||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.AnvilBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.loot.context.LootContext;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.IntProperty;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class EndAnvilBlock extends AnvilBlock implements BlockPatterned {
|
||||
public static final IntProperty DESTRUCTION = BlockProperties.DESTRUCTION;
|
||||
|
||||
public EndAnvilBlock(MaterialColor color) {
|
||||
super(FabricBlockSettings.copyOf(Blocks.ANVIL).materialColor(color));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
super.appendProperties(builder);
|
||||
builder.add(DESTRUCTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
|
@ -35,7 +50,18 @@ public class EndAnvilBlock extends AnvilBlock implements BlockPatterned {
|
|||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterns.createJson(Patterns.BLOCK_ANVIL, blockId.getPath(), blockId.getPath());
|
||||
Map<String, String> map = Maps.newHashMap();
|
||||
map.put("%anvil%", blockId.getPath());
|
||||
map.put("%top%", getTop(blockId, block));
|
||||
return Patterns.createJson(Patterns.BLOCK_ANVIL, map);
|
||||
}
|
||||
|
||||
private String getTop(Identifier blockId, String block) {
|
||||
if (block.contains("item")) {
|
||||
return blockId.getPath() + "_top_0";
|
||||
}
|
||||
char last = block.charAt(block.length() - 1);
|
||||
return blockId.getPath() + "_top_" + last;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
24
src/main/java/ru/betterend/mixin/common/AnvilBlockMixin.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.block.AnvilBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.basis.EndAnvilBlock;
|
||||
|
||||
@Mixin(AnvilBlock.class)
|
||||
public class AnvilBlockMixin {
|
||||
@Inject(method = "getLandingState", at = @At("HEAD"), cancellable = true)
|
||||
private static void be_getLandingState(BlockState fallingState, CallbackInfoReturnable<BlockState> info) {
|
||||
if (fallingState.getBlock() instanceof EndAnvilBlock) {
|
||||
int destruction = fallingState.get(BlockProperties.DESTRUCTION);
|
||||
BlockState state = (destruction < 2) ? fallingState.with(BlockProperties.DESTRUCTION, destruction + 1) : null;
|
||||
info.setReturnValue(state);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"variants": {
|
||||
"facing=east": {
|
||||
"model": "betterend:block/thallasium_anvil",
|
||||
"y": 270
|
||||
},
|
||||
"facing=north": {
|
||||
"model": "betterend:block/thallasium_anvil",
|
||||
"y": 180
|
||||
},
|
||||
"facing=south": {
|
||||
"model": "betterend:block/thallasium_anvil"
|
||||
},
|
||||
"facing=west": {
|
||||
"model": "betterend:block/thallasium_anvil",
|
||||
"y": 90
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
{
|
||||
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"particle": "betterend:block/thallasium_anvil_front",
|
||||
"front": "betterend:block/thallasium_anvil_front",
|
||||
"back": "betterend:block/thallasium_anvil_back",
|
||||
"top": "betterend:block/thallasium_anvil_top",
|
||||
"panel": "betterend:block/thallasium_anvil_panel",
|
||||
"bottom": "betterend:block/thallasium_anvil_bottom"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"__comment": "Bottom",
|
||||
"from": [ 2, 0, 2 ],
|
||||
"to": [ 14, 4, 14 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 2, 2, 14, 14 ], "texture": "#bottom", "cullface": "down" },
|
||||
"up": { "uv": [ 2, 2, 14, 14 ], "texture": "#panel" },
|
||||
"north": { "uv": [ 2, 12, 14, 16 ], "texture": "#back" },
|
||||
"south": { "uv": [ 2, 12, 14, 16 ], "texture": "#back" },
|
||||
"west": { "uv": [ 2, 12, 14, 16 ], "texture": "#front" },
|
||||
"east": { "uv": [ 2, 12, 14, 16 ], "texture": "#front" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Plate",
|
||||
"from": [ 4, 4, 3 ],
|
||||
"to": [ 12, 5, 13 ],
|
||||
"faces": {
|
||||
"up": { "uv": [ 4, 3, 12, 13 ], "texture": "#panel" },
|
||||
"north": { "uv": [ 4, 11, 12, 12 ], "texture": "#back" },
|
||||
"south": { "uv": [ 4, 11, 12, 12 ], "texture": "#back" },
|
||||
"west": { "uv": [ 3, 11, 13, 12 ], "texture": "#front" },
|
||||
"east": { "uv": [ 3, 11, 13, 12 ], "texture": "#front" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Support",
|
||||
"from": [ 6, 5, 4 ],
|
||||
"to": [ 10, 10, 12 ],
|
||||
"faces": {
|
||||
"north": { "uv": [ 6, 6, 10, 11 ], "texture": "#back" },
|
||||
"south": { "uv": [ 6, 6, 10, 11 ], "texture": "#back" },
|
||||
"west": { "uv": [ 4, 6, 12, 11 ], "texture": "#front" },
|
||||
"east": { "uv": [ 4, 6, 12, 11 ], "texture": "#front" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Top",
|
||||
"from": [ 3, 10, 0 ],
|
||||
"to": [ 13, 16, 16 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 3, 0, 13, 16 ], "texture": "#top" },
|
||||
"up": { "uv": [ 3, 0, 13, 16 ], "texture": "#top" },
|
||||
"north": { "uv": [ 3, 0, 13, 6 ], "texture": "#back" },
|
||||
"south": { "uv": [ 3, 0, 13, 6 ], "texture": "#back" },
|
||||
"west": { "uv": [ 0, 0, 16, 6 ], "texture": "#front" },
|
||||
"east": { "uv": [ 0, 0, 16, 6 ], "texture": "#front" }
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"fixed": {
|
||||
"rotation": [ 0, 90, 0 ],
|
||||
"scale": [ 0.5, 0.5, 0.5 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "betterend:block/thallasium_anvil"
|
||||
}
|
|
@ -1,8 +1,68 @@
|
|||
{
|
||||
"parent": "minecraft:block/template_anvil",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"top": "betterend:block/%block%_top",
|
||||
"body": "betterend:block/%block%",
|
||||
"particle": "#body"
|
||||
"particle": "betterend:block/%anvil%_front",
|
||||
"front": "betterend:block/%anvil%_front",
|
||||
"back": "betterend:block/%anvil%_back",
|
||||
"top": "betterend:block/%top%",
|
||||
"panel": "betterend:block/%anvil%_panel",
|
||||
"bottom": "betterend:block/%anvil%_bottom"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"__comment": "Bottom",
|
||||
"from": [ 2, 0, 2 ],
|
||||
"to": [ 14, 4, 14 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 2, 2, 14, 14 ], "texture": "#bottom", "cullface": "down" },
|
||||
"up": { "uv": [ 2, 2, 14, 14 ], "texture": "#panel" },
|
||||
"north": { "uv": [ 2, 12, 14, 16 ], "texture": "#back" },
|
||||
"south": { "uv": [ 2, 12, 14, 16 ], "texture": "#back" },
|
||||
"west": { "uv": [ 2, 12, 14, 16 ], "texture": "#front" },
|
||||
"east": { "uv": [ 2, 12, 14, 16 ], "texture": "#front" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Plate",
|
||||
"from": [ 4, 4, 3 ],
|
||||
"to": [ 12, 5, 13 ],
|
||||
"faces": {
|
||||
"up": { "uv": [ 4, 3, 12, 13 ], "texture": "#panel" },
|
||||
"north": { "uv": [ 4, 11, 12, 12 ], "texture": "#back" },
|
||||
"south": { "uv": [ 4, 11, 12, 12 ], "texture": "#back" },
|
||||
"west": { "uv": [ 3, 11, 13, 12 ], "texture": "#front" },
|
||||
"east": { "uv": [ 3, 11, 13, 12 ], "texture": "#front" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Support",
|
||||
"from": [ 6, 5, 4 ],
|
||||
"to": [ 10, 10, 12 ],
|
||||
"faces": {
|
||||
"north": { "uv": [ 6, 6, 10, 11 ], "texture": "#back" },
|
||||
"south": { "uv": [ 6, 6, 10, 11 ], "texture": "#back" },
|
||||
"west": { "uv": [ 4, 6, 12, 11 ], "texture": "#front" },
|
||||
"east": { "uv": [ 4, 6, 12, 11 ], "texture": "#front" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Top",
|
||||
"from": [ 3, 10, 0 ],
|
||||
"to": [ 13, 16, 16 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 3, 0, 13, 16 ], "texture": "#top" },
|
||||
"up": { "uv": [ 3, 0, 13, 16 ], "texture": "#top" },
|
||||
"north": { "uv": [ 3, 0, 13, 6 ], "texture": "#back" },
|
||||
"south": { "uv": [ 3, 0, 13, 6 ], "texture": "#back" },
|
||||
"west": { "uv": [ 0, 0, 16, 6 ], "texture": "#front" },
|
||||
"east": { "uv": [ 0, 0, 16, 6 ], "texture": "#front" }
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"fixed": {
|
||||
"rotation": [ 0, 90, 0 ],
|
||||
"scale": [ 0.5, 0.5, 0.5 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +1,16 @@
|
|||
{
|
||||
"variants": {
|
||||
"facing=east": {
|
||||
"model": "betterend:pattern/%block%",
|
||||
"y": 270
|
||||
},
|
||||
"facing=north": {
|
||||
"model": "betterend:pattern/%block%",
|
||||
"y": 180
|
||||
},
|
||||
"facing=south": {
|
||||
"model": "betterend:pattern/%block%"
|
||||
},
|
||||
"facing=west": {
|
||||
"model": "betterend:pattern/%block%",
|
||||
"y": 90
|
||||
}
|
||||
"destruction=0,facing=east": { "model": "betterend:pattern/%block%/%block%_0", "y": 270 },
|
||||
"destruction=0,facing=north": { "model": "betterend:pattern/%block%/%block%_0", "y": 180 },
|
||||
"destruction=0,facing=south": { "model": "betterend:pattern/%block%/%block%_0" },
|
||||
"destruction=0,facing=west": { "model": "betterend:pattern/%block%/%block%_0", "y": 90 },
|
||||
"destruction=1,facing=east": { "model": "betterend:pattern/%block%/%block%_1", "y": 270 },
|
||||
"destruction=1,facing=north": { "model": "betterend:pattern/%block%/%block%_1", "y": 180 },
|
||||
"destruction=1,facing=south": { "model": "betterend:pattern/%block%/%block%_1" },
|
||||
"destruction=1,facing=west": { "model": "betterend:pattern/%block%/%block%_1", "y": 90 },
|
||||
"destruction=2,facing=east": { "model": "betterend:pattern/%block%/%block%_2", "y": 270 },
|
||||
"destruction=2,facing=north": { "model": "betterend:pattern/%block%/%block%_2", "y": 180 },
|
||||
"destruction=2,facing=south": { "model": "betterend:pattern/%block%/%block%_2" },
|
||||
"destruction=2,facing=west": { "model": "betterend:pattern/%block%/%block%_2", "y": 90 }
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 423 B After Width: | Height: | Size: 372 B |
Before Width: | Height: | Size: 328 B After Width: | Height: | Size: 298 B |
Before Width: | Height: | Size: 456 B After Width: | Height: | Size: 370 B |
Before Width: | Height: | Size: 561 B After Width: | Height: | Size: 368 B |
Before Width: | Height: | Size: 329 B |
After Width: | Height: | Size: 314 B |
After Width: | Height: | Size: 400 B |
After Width: | Height: | Size: 382 B |
|
@ -32,6 +32,7 @@
|
|||
"BoneMealItemMixin",
|
||||
"PlayerEntityMixin",
|
||||
"SlimeEntityMixin",
|
||||
"AnvilBlockMixin",
|
||||
"BrewingAccessor",
|
||||
"EntityMixin"
|
||||
],
|
||||
|
|