mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Adjust model and hitbox sizes of fruit
This commit is contained in:
parent
1cd3390b1e
commit
b2e3008141
5 changed files with 38 additions and 13 deletions
|
@ -7,26 +7,25 @@ import com.minelittlepony.unicopia.ability.EarthPonyKickAbility.Buckable;
|
|||
import net.minecraft.block.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.*;
|
||||
|
||||
public class FruitBlock extends Block implements Buckable {
|
||||
public static final int DEFAULT_FRUIT_SIZE = 8;
|
||||
public static final VoxelShape DEFAULT_SHAPE = createFruitShape(DEFAULT_FRUIT_SIZE);
|
||||
public static final int DEFAULT_FRUIT_SIZE = 5;
|
||||
public static final double DEFAULT_STEM_OFFSET = 2.6F;
|
||||
public static final VoxelShape DEFAULT_SHAPE = createFruitShape(DEFAULT_STEM_OFFSET, DEFAULT_FRUIT_SIZE);
|
||||
|
||||
private final Direction attachmentFace;
|
||||
private final Block stem;
|
||||
private final VoxelShape shape;
|
||||
|
||||
public static VoxelShape createFruitShape(int fruitSize) {
|
||||
int min = (16 - fruitSize) / 2;
|
||||
int max = 16 - min;
|
||||
|
||||
return VoxelShapes.cuboid(min / 16D, (max - fruitSize) / 16D, min / 16D, max / 16D, 1, max / 16D);
|
||||
public static VoxelShape createFruitShape(double stemOffset, double fruitSize) {
|
||||
final double min = (16 - fruitSize) * 0.5;
|
||||
final double max = 16 - min;
|
||||
final double top = 16 - stemOffset;
|
||||
return createCuboidShape(min, top - fruitSize, min, max, top, max);
|
||||
}
|
||||
|
||||
public FruitBlock(Settings settings, Direction attachmentFace, Block stem, VoxelShape shape) {
|
||||
|
|
26
src/main/resources/assets/unicopia/models/block/fruit.json
Normal file
26
src/main/resources/assets/unicopia/models/block/fruit.json
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"particle": "#cross"
|
||||
},
|
||||
"elements": [
|
||||
{ "from": [ 4.8, 8, 8 ],
|
||||
"to": [ 11.2, 16, 8 ],
|
||||
"rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 45, "rescale": true },
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#cross" },
|
||||
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#cross" }
|
||||
}
|
||||
},
|
||||
{ "from": [ 8, 8, 4.8 ],
|
||||
"to": [ 8, 16, 11.2 ],
|
||||
"rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 45, "rescale": true },
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#cross" },
|
||||
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#cross" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "minecraft:block/cross",
|
||||
"parent": "unicopia:block/fruit",
|
||||
"textures": {
|
||||
"cross": "unicopia:item/green_apple"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "minecraft:block/cross",
|
||||
"parent": "unicopia:block/fruit",
|
||||
"textures": {
|
||||
"cross": "unicopia:item/zap_apple"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "minecraft:block/cross",
|
||||
"parent": "unicopia:block/fruit",
|
||||
"textures": {
|
||||
"cross": "unicopia:item/zap_bulb"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue