Texture changes and refinements

This commit is contained in:
Sollace 2020-05-03 16:59:20 +02:00
parent bbfebe009a
commit 42f8e4d1e7
78 changed files with 335 additions and 204 deletions

View file

@ -39,7 +39,16 @@ public class ChiselledChitinBlock extends Block {
@Override
@Nullable
public BlockState getPlacementState(ItemPlacementContext context) {
return getDefaultState().with(Properties.FACING, context.getPlayerFacing());
PlayerEntity player = context.getPlayer();
Direction direction = player == null ? context.getSide() : context.getPlayerLookDirection().getOpposite();
if (player != null && player.isSneaking()) {
direction = direction.getOpposite();
}
return getDefaultState().with(Properties.FACING, direction);
}
@Override

View file

@ -1,16 +1,15 @@
package com.minelittlepony.unicopia.block;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.entity.player.Pony;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.EntityContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.util.StringIdentifiable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
@ -18,11 +17,9 @@ import net.minecraft.world.IWorld;
public class ChitinBlock extends Block {
public static final EnumProperty<Covering> COVERING = EnumProperty.of("covering", Covering.class);
public ChitinBlock(Settings settings) {
super(settings);
setDefaultState(stateManager.getDefaultState().with(COVERING, Covering.UNCOVERED));
setDefaultState(stateManager.getDefaultState().with(Covering.PROPERTY, Covering.UNCOVERED));
}
@Deprecated
@ -44,16 +41,19 @@ public class ChitinBlock extends Block {
return hardness;
}
@Override
@Nullable
public BlockState getPlacementState(ItemPlacementContext context) {
Direction side = context.getSide();
return getDefaultState().with(Covering.PROPERTY, Covering.getCovering(context.getWorld(), context.getBlockPos().offset(side)));
}
@Override
@Deprecated
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState other, IWorld world, BlockPos pos, BlockPos otherPos) {
if (direction == Direction.UP) {
Block block = other.getBlock();
boolean snowy = block == Blocks.SNOW_BLOCK || block == Blocks.SNOW;
boolean solid = (other.isOpaque() && other.isSimpleFullBlock(world, pos)) || Block.isFaceFullSquare(other.getCollisionShape(world, otherPos, EntityContext.absent()), Direction.DOWN);
return state.with(COVERING, snowy ? Covering.SNOW_COVERED : solid ? Covering.COVERED : Covering.UNCOVERED);
return state.with(Covering.PROPERTY, Covering.getCovering(world, otherPos));
}
return state;
@ -61,23 +61,6 @@ public class ChitinBlock extends Block {
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(COVERING);
}
public enum Covering implements StringIdentifiable {
COVERED,
UNCOVERED,
SNOW_COVERED;
@Override
public String toString() {
return asString();
}
@Override
public String asString() {
return name().toLowerCase();
}
builder.add(Covering.PROPERTY);
}
}

View file

@ -0,0 +1,44 @@
package com.minelittlepony.unicopia.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.EntityContext;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.util.StringIdentifiable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.IWorld;
public enum Covering implements StringIdentifiable {
COVERED,
UNCOVERED,
SNOW_COVERED;
public static final EnumProperty<Covering> PROPERTY = EnumProperty.of("covering", Covering.class);
@Override
public String toString() {
return asString();
}
@Override
public String asString() {
return name().toLowerCase();
}
public static Covering getCovering(IWorld world, BlockPos pos) {
BlockState state = world.getBlockState(pos);
Block block = state.getBlock();
if (block == Blocks.SNOW_BLOCK || block == Blocks.SNOW) {
return Covering.SNOW_COVERED;
}
if ((state.isOpaque() && state.isSimpleFullBlock(world, pos)) || Block.isFaceFullSquare(state.getCollisionShape(world, pos, EntityContext.absent()), Direction.DOWN)) {
return Covering.COVERED;
}
return Covering.UNCOVERED;
}
}

View file

@ -4,22 +4,14 @@ import javax.annotation.Nullable;
import com.minelittlepony.unicopia.EquinePredicates;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class DiamondDoorBlock extends AbstractDoorBlock {
public DiamondDoorBlock() {
super(FabricBlockSettings.of(Material.METAL)
.sounds(BlockSoundGroup.METAL)
.materialColor(MaterialColor.DIAMOND)
.hardness(5)
.build());
public DiamondDoorBlock(Settings settings) {
super(settings);
}
@Override

View file

@ -7,7 +7,9 @@ import com.minelittlepony.unicopia.gas.CloudDoorBlock;
import com.minelittlepony.unicopia.gas.CloudFarmlandBlock;
import com.minelittlepony.unicopia.gas.CloudFenceBlock;
import com.minelittlepony.unicopia.gas.CloudSlabBlock;
import com.minelittlepony.unicopia.gas.CloudSoilBlock;
import com.minelittlepony.unicopia.gas.CloudStairsBlock;
import com.minelittlepony.unicopia.gas.CoverableCloudBlock;
import com.minelittlepony.unicopia.gas.GasState;
import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.structure.CustomSaplingGenerator;
@ -27,26 +29,39 @@ import net.minecraft.util.registry.Registry;
public interface UBlocks {
CloudFarmlandBlock CLOUD_FARMLAND = register("cloud_farmland", new CloudFarmlandBlock(GasState.NORMAL.configure().build()));
CloudBlock CLOUD_BLOCK = register("cloud_block", new CloudBlock(GasState.NORMAL));
CloudBlock ENCHANTED_CLOUD_BLOCK = register("enchanted_cloud_block", new CloudBlock(GasState.ENCHANTED));
CloudBlock CLOUD_BLOCK = register("cloud_block", new CloudSoilBlock(GasState.NORMAL));
CloudBlock ENCHANTED_CLOUD_BLOCK = register("enchanted_cloud_block", new CoverableCloudBlock(GasState.ENCHANTED));
CloudBlock DENSE_CLOUD_BLOCK = register("dense_cloud_block", new CloudBlock(GasState.DENSE));
CloudStairsBlock<CloudBlock> CLOUD_STAIRS = register("cloud_stairs", new CloudStairsBlock<>(CLOUD_BLOCK.getDefaultState(), GasState.NORMAL.configure().build()));
CloudSlabBlock<CloudBlock> CLOUD_SLAB = register("cloud_slab", new CloudSlabBlock<>(CLOUD_BLOCK.getDefaultState(), GasState.NORMAL.configure().build()));
CloudSlabBlock<CloudBlock> ENCHANTED_CLOUD_SLAB = register("enchanted_cloud_slab", new CloudSlabBlock<>(ENCHANTED_CLOUD_BLOCK.getDefaultState(), GasState.ENCHANTED.configure().build()));
CloudSlabBlock<CloudBlock> DENSE_CLOUD_SLAB = register("dense_cloud_slab", new CloudSlabBlock<>(ENCHANTED_CLOUD_BLOCK.getDefaultState(), GasState.DENSE.configure().build()));
CloudSlabBlock<CloudBlock> DENSE_CLOUD_SLAB = register("dense_cloud_slab", new CloudSlabBlock<>(DENSE_CLOUD_BLOCK.getDefaultState(), GasState.DENSE.configure().build()));
CloudDoorBlock MISTED_GLASS_DOOR = register("misted_glass_door", new CloudDoorBlock());
CloudDoorBlock MISTED_GLASS_DOOR = register("misted_glass_door", new CloudDoorBlock(FabricBlockSettings.of(Material.GLASS)
.sounds(BlockSoundGroup.GLASS)
.hardness(3)
.resistance(200)
.nonOpaque()
.breakByTool(FabricToolTags.PICKAXES, 0)
.build()));
DutchDoorBlock LIBRARY_DOOR = register("library_door", new DutchDoorBlock(FabricBlockSettings.of(Material.WOOD).
sounds(BlockSoundGroup.WOOD)
.hardness(3)
.nonOpaque()
.build()));
DutchDoorBlock BAKERY_DOOR = register("bakery_door", new DutchDoorBlock(FabricBlockSettings.of(Material.WOOD)
.sounds(BlockSoundGroup.WOOD)
.hardness(3)
.nonOpaque()
.build()));
DiamondDoorBlock DIAMOND_DOOR = register("diamond_door", new DiamondDoorBlock(FabricBlockSettings.of(Material.METAL)
.sounds(BlockSoundGroup.METAL)
.materialColor(MaterialColor.DIAMOND)
.strength(6, 20)
.nonOpaque()
.build()));
DiamondDoorBlock DIAMOND_DOOR = register("diamond_door", new DiamondDoorBlock());
GemTorchBlock ENCHANTED_TORCH = register("enchanted_torch", new GemTorchBlock(FabricBlockSettings.of(Material.PART)
.noCollision()
@ -93,14 +108,15 @@ public interface UBlocks {
.ticksRandomly()
.lightLevel(1)
.sounds(BlockSoundGroup.SAND)
.breakByTool(FabricToolTags.PICKAXES, 1)
.breakByTool(FabricToolTags.SHOVELS, 1)
.build()));
ChitinBlock CHITIN_SHELL_BLOCK = register("chitin_shell_block", new ChitinBlock(FabricBlockSettings.of(UMaterials.CHITIN)
.hardness(50)
.strength(2000, 2000)
.strength(50, 2000)
.breakByTool(FabricToolTags.PICKAXES, 2)
.build()));
Block CHISELED_CHITIN_SHELL_BLOCK = register("chiseled_chitin_shell_block", new ChiselledChitinBlock(FabricBlockSettings.of(UMaterials.CHITIN)
.strength(50, 2000)
.breakByTool(FabricToolTags.PICKAXES, 2)
.build()));
SlimeDropBlock SLIME_DROP = register("slime_drop", new SlimeDropBlock(FabricBlockSettings.of(UMaterials.HIVE, MaterialColor.GRASS)
@ -121,6 +137,7 @@ public interface UBlocks {
.strength(10, 10)
.hardness(0.7F)
.sounds(BlockSoundGroup.SAND)
.breakByTool(FabricToolTags.SHOVELS)
.build()));
Block APPLE_LEAVES = register("apple_leaves", new FruitLeavesBlock(FabricBlockSettings.of(Material.LEAVES)
.strength(0.2F, 0.2F)

View file

@ -42,7 +42,8 @@ public interface URenderers {
ParticleFactoryRegistry.getInstance().register(UParticles.SPHERE, SphereParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(UParticles.DISK, DiskParticle.Factory::new);
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), UBlocks.ENCHANTED_TORCH, UBlocks.ENCHANTED_WALL_TORCH);
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), UBlocks.ENCHANTED_TORCH, UBlocks.ENCHANTED_WALL_TORCH,
UBlocks.BAKERY_DOOR, UBlocks.LIBRARY_DOOR, UBlocks.MISTED_GLASS_DOOR, UBlocks.DIAMOND_DOOR);
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getTranslucent(),
UBlocks.CLOUD_ANVIL, UBlocks.CLOUD_FARMLAND,
UBlocks.CLOUD_BLOCK, UBlocks.CLOUD_SLAB, UBlocks.CLOUD_STAIRS, UBlocks.CLOUD_FENCE,

View file

@ -30,23 +30,21 @@ public class SpellbookEntityRender extends LivingEntityRenderer<SpellbookEntity,
}
@Override
protected void setupTransforms(SpellbookEntity entity, MatrixStack matrices, float p_77043_2_, float p_77043_3_, float partialTicks) {
protected void setupTransforms(SpellbookEntity entity, MatrixStack matrices, float f, float g, float partialTicks) {
super.setupTransforms(entity, matrices, f, g + 90, partialTicks);
if (!entity.getIsOpen()) {
matrices.translate(0, 1.44f, 0);
} else {
matrices.translate(0, 1.2f + MathHelper.sin((entity.age + partialTicks) / 20) * 0.01F + 0.1F, 0);
}
if (entity.getIsOpen()) {
matrices.translate(-1.25F, -0.35F, 0);
if (!entity.getIsOpen()) {
matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(90));
matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(90));
matrices.translate(-0.25f, 0, 0);
} else {
float floatPosition = MathHelper.sin((entity.age + partialTicks + entity.getEntityId()) / 20) * 0.04F;
matrices.translate(0, floatPosition, 0);
matrices.multiply(Vector3f.NEGATIVE_Z.getDegreesQuaternion(60));
} else {
matrices.translate(-1.5F, 0.1F, 0.2F);
matrices.multiply(Vector3f.NEGATIVE_Z.getDegreesQuaternion(90));
matrices.multiply(Vector3f.NEGATIVE_Y.getDegreesQuaternion(90));
}
matrices.multiply(Vector3f.NEGATIVE_Y.getDegreesQuaternion(MathHelper.lerp(entity.prevYaw, entity.yaw, partialTicks)));
}
@Override

View file

@ -12,15 +12,15 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
public class SpellbookModel extends EntityModel<SpellbookEntity> {
private final ModelPart leftCover = (new ModelPart(64, 32, 0, 0)).addCuboid(-6, -5, -0.005F, 6, 10, 0.005F);
private final ModelPart rightCover = (new ModelPart(64, 32, 16, 0)).addCuboid(0, -5, -0.005F, 6, 10, 0.005F);
private final ModelPart leftBlock = (new ModelPart(64, 32, 0, 10)).addCuboid(0, -4, -0.99F, 5, 8, 1);
private final ModelPart rightBlock = (new ModelPart(64, 32, 12, 10)).addCuboid(0, -4, -0.01F, 5, 8, 1);
private final ModelPart leftPage = (new ModelPart(64, 32, 24, 10)).addCuboid(0, -4, 0, 5, 8, 0.005F);
private final ModelPart rightPage = (new ModelPart(64, 32, 24, 10)).addCuboid(0, -4, 0, 5, 8, 0.005F);
private final ModelPart spine = (new ModelPart(64, 32, 12, 0)).addCuboid(-1, -5, 0, 2, 10, 0.005F);
private ModelPart leftCover = new ModelPart(64, 32, 0, 0).addCuboid(-6, -5, -0.005F, 6, 10, 0.005F);
private ModelPart rightCover = new ModelPart(64, 32, 16, 0).addCuboid(0, -5, -0.005F, 6, 10, 0.005F);
private ModelPart leftBlock = new ModelPart(64, 32, 0, 10).addCuboid(0, -4, -0.99F, 5, 8, 1);
private ModelPart rightBlock = new ModelPart(64, 32, 12, 10).addCuboid(0, -4, -0.01F, 5, 8, 1);
private ModelPart leftPage = new ModelPart(64, 32, 24, 10).addCuboid(0, -4, 0, 5, 8, 0.005F);
private ModelPart rightPage = new ModelPart(64, 32, 24, 10).addCuboid(0, -4, 0, 5, 8, 0.005F);
private ModelPart spine = new ModelPart(64, 32, 12, 0).addCuboid(-1, -5, 0, 2, 10, 0.005F);
private final List<ModelPart> parts = ImmutableList.of(leftCover, rightCover, spine, leftBlock, rightBlock, leftPage, rightPage);
private List<ModelPart> parts = ImmutableList.of(leftCover, rightCover, spine, leftBlock, rightBlock, leftPage, rightPage);
public SpellbookModel() {
leftCover.setPivot(0, 0, -1);
@ -30,13 +30,26 @@ public class SpellbookModel extends EntityModel<SpellbookEntity> {
@Override
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
parts.forEach(modelPart -> {
modelPart.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
});
parts.forEach(modelPart -> modelPart.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha));
leftCover = (new ModelPart(64, 32, 0, 0)).addCuboid(-6, -5, -0.005F, 6, 10, 0.005F);
rightCover = (new ModelPart(64, 32, 16, 0)).addCuboid(0, -5, -0.005F, 6, 10, 0.005F);
leftBlock = (new ModelPart(64, 32, 0, 10)).addCuboid(0.01F, -4, -0.99F, 5, 8, 1);
rightBlock = (new ModelPart(64, 32, 12, 10)).addCuboid(0.01F, -4, -0.01F, 5, 8, 1);
leftPage = (new ModelPart(64, 32, 24, 10)).addCuboid(0, -4, 0, 5, 8, 0.005F);
rightPage = (new ModelPart(64, 32, 24, 10)).addCuboid(0, -4, 0, 5, 8, 0.005F);
spine = (new ModelPart(64, 32, 12, 0)).addCuboid(-1, -5, 0, 2, 10, 0.005F);
leftCover.setPivot(0, 0, -1);
rightCover.setPivot(0, 0, 1);
spine.yaw = 1.5707964F;
parts = ImmutableList.of(leftCover, rightCover, spine, leftBlock, rightBlock, leftPage, rightPage);
}
public void setPageAngles(float breath, float leftPageRot, float rightPageRot, float openAngle) {
float j = (MathHelper.sin(breath * 0.02F) * 0.1F + 1.25F) * openAngle;
leftCover.yaw = 3.1415927F + j;
rightCover.yaw = -j;
leftBlock.yaw = j;

View file

@ -17,6 +17,7 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.predicate.entity.EntityPredicates;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
@ -95,7 +96,6 @@ public class SpellbookEntity extends MobEntity implements NameableContainerFacto
jumping = open && isTouchingWater();
super.tick();
if (open && world.isClient) {
for (int offX = -2; offX <= 1; ++offX) {
for (int offZ = -2; offZ <= 1; ++offZ) {
if (offX > -1 && offX < 1 && offZ == -1) {
@ -116,6 +116,17 @@ public class SpellbookEntity extends MobEntity implements NameableContainerFacto
}
}
if (open) {
world.getEntities(this, getBoundingBox().expand(2), EntityPredicates.EXCEPT_SPECTATOR.and(e -> e instanceof PlayerEntity)).stream().findFirst().ifPresent(player -> {
Vec3d diff = player.getPosVector().subtract(getPosVector());
double yaw = Math.atan2(diff.z, diff.x) * 180D / Math.PI - 90;
setHeadYaw((float)yaw);
setYaw((float)yaw);
});
}
if (world.random.nextInt(30) == 0) {
float celest = world.getSkyAngleRadians(1) * 4;
@ -164,11 +175,8 @@ public class SpellbookEntity extends MobEntity implements NameableContainerFacto
}
if (EquinePredicates.PLAYER_UNICORN.test(player)) {
player.playSound(SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, 2, 1);
player.openContainer(this);
return ActionResult.SUCCESS;
}

View file

@ -2,11 +2,7 @@ package com.minelittlepony.unicopia.gas;
import java.util.Random;
import com.minelittlepony.unicopia.block.UBlocks;
import com.minelittlepony.unicopia.blockstate.StateMaps;
import com.minelittlepony.unicopia.entity.player.Pony;
import com.minelittlepony.unicopia.util.HoeUtil;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
@ -14,7 +10,6 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
@ -24,7 +19,7 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.EmptyBlockView;
import net.minecraft.world.World;
public class CloudBlock extends Block implements Gas, HoeUtil.Tillable {
public class CloudBlock extends Block implements Gas {
private final GasState variant;
@ -34,7 +29,6 @@ public class CloudBlock extends Block implements Gas, HoeUtil.Tillable {
.build()
);
this.variant = variant;
HoeUtil.registerTillingAction(this, UBlocks.CLOUD_FARMLAND.getDefaultState());
}
@Override
@ -81,7 +75,7 @@ public class CloudBlock extends Block implements Gas, HoeUtil.Tillable {
@Override
@Environment(EnvType.CLIENT)
public boolean isSideInvisible(BlockState state, BlockState beside, Direction face) {
if (beside.getBlock() instanceof Gas) {
if (beside.getBlock() instanceof Gas && ((Gas)beside.getBlock()).getGasState(beside) == getGasState(state)) {
VoxelShape myShape = state.getCollisionShape(EmptyBlockView.INSTANCE, BlockPos.ORIGIN);
VoxelShape otherShape = beside.getCollisionShape(EmptyBlockView.INSTANCE, BlockPos.ORIGIN);
@ -125,9 +119,4 @@ public class CloudBlock extends Block implements Gas, HoeUtil.Tillable {
public GasState getGasState(BlockState blockState) {
return variant;
}
@Override
public boolean canTill(ItemUsageContext context) {
return context.getPlayer() == null || Pony.of(context.getPlayer()).getSpecies().canInteractWithClouds();
}
}

View file

@ -1,13 +1,9 @@
package com.minelittlepony.unicopia.gas;
import com.minelittlepony.unicopia.block.AbstractDoorBlock;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tools.FabricToolTags;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
@ -16,13 +12,8 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World;
public class CloudDoorBlock extends AbstractDoorBlock implements Gas {
public CloudDoorBlock() {
super(FabricBlockSettings.of(Material.GLASS)
.sounds(BlockSoundGroup.GLASS)
.hardness(3)
.resistance(200)
.breakByTool(FabricToolTags.PICKAXES, 0)
.build());
public CloudDoorBlock(Settings settings) {
super(settings);
}
@Override

View file

@ -0,0 +1,20 @@
package com.minelittlepony.unicopia.gas;
import com.minelittlepony.unicopia.block.UBlocks;
import com.minelittlepony.unicopia.entity.player.Pony;
import com.minelittlepony.unicopia.util.HoeUtil;
import net.minecraft.item.ItemUsageContext;
public class CloudSoilBlock extends CloudBlock implements HoeUtil.Tillable {
public CloudSoilBlock(GasState variant) {
super(variant);
HoeUtil.registerTillingAction(this, UBlocks.CLOUD_FARMLAND.getDefaultState());
}
@Override
public boolean canTill(ItemUsageContext context) {
return context.getPlayer() == null || Pony.of(context.getPlayer()).getSpecies().canInteractWithClouds();
}
}

View file

@ -0,0 +1,44 @@
package com.minelittlepony.unicopia.gas;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.block.Covering;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.IWorld;
public class CoverableCloudBlock extends CloudBlock {
public CoverableCloudBlock(GasState variant) {
super(variant);
setDefaultState(stateManager.getDefaultState().with(Covering.PROPERTY, Covering.UNCOVERED));
}
@Override
@Nullable
public BlockState getPlacementState(ItemPlacementContext context) {
Direction side = context.getSide();
return getDefaultState().with(Covering.PROPERTY, Covering.getCovering(context.getWorld(), context.getBlockPos().offset(side)));
}
@Override
@Deprecated
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState other, IWorld world, BlockPos pos, BlockPos otherPos) {
if (direction == Direction.UP) {
return state.with(Covering.PROPERTY, Covering.getCovering(world, otherPos));
}
return state;
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(Covering.PROPERTY);
}
}

View file

@ -49,6 +49,10 @@ public enum GasState {
}
private boolean heldCanTouch(CloudInteractionContext context) {
if (this == ENCHANTED) {
return true;
}
ItemStack main = context.getHeldStack();
if (main.getItem() instanceof BlockItem) {
@ -58,7 +62,7 @@ public enum GasState {
return true;
}
return this == GasState.NORMAL && (
return this == NORMAL && (
block instanceof TorchBlock
|| block instanceof BedBlock
|| block instanceof ChestBlock);

View file

@ -25,7 +25,7 @@ public class SpellbookItem extends BookItem {
Direction facing = source.getBlockState().get(DispenserBlock.FACING);
BlockPos pos = source.getBlockPos().offset(facing);
int yaw = facing.getOpposite().getHorizontal() * 90;
float yaw = facing.getOpposite().asRotation();
placeBook(source.getWorld(), pos.getX(), pos.getY(), pos.getZ(), yaw);
stack.decrement(1);
@ -42,11 +42,7 @@ public class SpellbookItem extends BookItem {
if (!context.getWorld().isClient && EquinePredicates.PLAYER_UNICORN.test(player)) {
BlockPos pos = context.getBlockPos().offset(context.getSide());
double diffX = player.getX() - (pos.getX() + 0.5);
double diffZ = player.getZ() - (pos.getZ() + 0.5);
float yaw = (float)Math.toDegrees(Math.atan2(diffZ, diffX) + Math.PI);
placeBook(context.getWorld(), pos.getX(), pos.getY(), pos.getZ(), yaw);
placeBook(context.getWorld(), pos.getX(), pos.getY(), pos.getZ(), context.getPlayerYaw() + 180);
if (!player.abilities.creativeMode) {
player.getStackInHand(context.getHand()).decrement(1);
@ -60,9 +56,9 @@ public class SpellbookItem extends BookItem {
private static void placeBook(World world, int x, int y, int z, float yaw) {
SpellbookEntity book = UEntities.SPELLBOOK.create(world);
book.updatePositionAndAngles(x + 0.5, y, z + 0.5, yaw, 0);
book.prevYaw = yaw;
book.refreshPositionAndAngles(x + 0.5, y, z + 0.5, 0, 0);
book.setHeadYaw(yaw);
book.setYaw(yaw);
world.spawnEntity(book);
}
}

View file

@ -1,5 +1,7 @@
{
"variants": {
"": { "model": "unicopia:block/enchanted_cloud_block" }
"covering=uncovered": { "model": "unicopia:block/enchanted_cloud_block" },
"covering=covered": { "model": "unicopia:block/enchanted_cloud_block_covered" },
"covering=snow_covered": { "model": "unicopia:block/enchanted_cloud_block" }
}
}

View file

@ -2,9 +2,9 @@
"parent": "block/cube_all",
"textures": {
"bottom": "unicopia:blocks/chitin_block_covered",
"particle": "unicopia:blocks/chitin_block_uncovered",
"top": "unicopia:blocks/chitin_block_top",
"side": "unicopia:blocks/chitin_block_uncovered"
"side": "unicopia:blocks/chitin_block_uncovered",
"particle": "#side"
},
"elements": [
{ "from": [ 0, 0, 0 ],

View file

@ -1,8 +1,8 @@
{
"parent": "block/anvil",
"textures": {
"particle": "unicopia:blocks/cloud_normal",
"body": "unicopia:blocks/cloud_normal",
"top": "unicopia:blocks/cloud_normal"
"particle": "unicopia:blocks/cloud_block",
"body": "unicopia:blocks/cloud_block",
"top": "unicopia:blocks/cloud_block"
}
}

View file

@ -1,6 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "unicopia:blocks/cloud_normal"
"all": "unicopia:blocks/cloud_block"
}
}

View file

@ -13,8 +13,8 @@
},
"ambientocclusion": false,
"textures": {
"texture": "unicopia:blocks/cloud_normal",
"particle": "unicopia:blocks/cloud_normal"
"texture": "unicopia:blocks/dense_cloud_block",
"particle": "#texture"
},
"elements": [
{ "from": [ 6, 0, 0 ],

View file

@ -1,6 +1,6 @@
{
"parent": "block/fence_post",
"textures": {
"texture": "unicopia:blocks/cloud_normal"
"texture": "unicopia:blocks/dense_cloud_block"
}
}

View file

@ -1,7 +1,7 @@
{
"textures": {
"texture": "unicopia:blocks/cloud_normal",
"particle": "unicopia:blocks/cloud_normal"
"texture": "unicopia:blocks/dense_cloud_block",
"particle": "#texture"
},
"elements": [
{ "from": [ 7, 10, 0 ],

View file

@ -1,9 +1,9 @@
{
"textures": {
"bottom": "unicopia:blocks/cloud_normal",
"top": "unicopia:blocks/cloud_normal",
"side": "unicopia:blocks/cloud_normal",
"particle": "unicopia:blocks/cloud_normal"
"bottom": "unicopia:blocks/cloud_block",
"top": "#bottom",
"side": "#bottom",
"particle": "#bottom"
},
"elements": [
{ "from": [ 0, 0, 0 ],

View file

@ -1,9 +1,9 @@
{
"textures": {
"bottom": "unicopia:blocks/cloud_normal",
"top": "unicopia:blocks/cloud_normal",
"side": "unicopia:blocks/cloud_normal",
"particle": "unicopia:blocks/cloud_normal"
"bottom": "unicopia:blocks/cloud_block",
"top": "#bottom",
"side": "#bottom",
"particle": "#bottom"
},
"elements": [
{ "from": [ 0, 0, 0 ],

View file

@ -1,8 +1,8 @@
{
"parent": "block/slab",
"textures": {
"bottom": "unicopia:blocks/cloud_normal",
"top": "unicopia:blocks/cloud_normal",
"side": "unicopia:blocks/cloud_normal"
"bottom": "unicopia:blocks/cloud_block",
"top": "#bottom",
"side": "#bottom"
}
}

View file

@ -1,8 +1,8 @@
{
"parent": "block/slab_top",
"textures": {
"bottom": "unicopia:blocks/cloud_normal",
"top": "unicopia:blocks/cloud_normal",
"side": "unicopia:blocks/cloud_normal"
"bottom": "unicopia:blocks/cloud_block",
"top": "#bottom",
"side": "#bottom"
}
}

View file

@ -17,10 +17,10 @@
}
},
"textures": {
"bottom": "unicopia:blocks/cloud_normal",
"top": "unicopia:blocks/cloud_normal",
"side": "unicopia:blocks/cloud_normal",
"particle": "unicopia:blocks/cloud_normal"
"bottom": "unicopia:blocks/cloud_block",
"top": "#bottom",
"side": "#bottom",
"particle": "#bottom"
},
"elements": [
{ "from": [ 0, 0, 0 ],

View file

@ -1,7 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "unicopia:blocks/cloud_packed_top",
"side": "unicopia:blocks/cloud_packed"
"end": "unicopia:blocks/dense_cloud_block_top",
"side": "unicopia:blocks/dense_cloud_block"
}
}

View file

@ -1,8 +1,8 @@
{
"parent": "block/slab",
"textures": {
"bottom": "unicopia:blocks/cloud_packed_top",
"top": "unicopia:blocks/cloud_packed",
"side": "unicopia:blocks/cloud_packed"
"bottom": "unicopia:blocks/dense_cloud_block",
"top": "unicopia:blocks/dense_cloud_block_top",
"side": "unicopia:blocks/dense_cloud_block"
}
}

View file

@ -1,8 +1,8 @@
{
"parent": "block/slab_top",
"textures": {
"bottom": "unicopia:blocks/cloud_packed",
"top": "unicopia:blocks/cloud_packed_top",
"side": "unicopia:blocks/cloud_packed"
"bottom": "unicopia:blocks/dense_cloud_block_top",
"top": "unicopia:blocks/dense_cloud_block",
"side": "unicopia:blocks/dense_cloud_block"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "unicopia:block/door/bottom",
"textures": {
"bottom": "unicopia:blocks/door_bakery_lower",
"top": "unicopia:blocks/door_bakery_upper"
"bottom": "unicopia:blocks/bakery_door_lower",
"top": "unicopia:blocks/bakery_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "unicopia:block/door/bottom_rh",
"textures": {
"bottom": "unicopia:blocks/door_bakery_lower",
"top": "unicopia:blocks/door_bakery_upper"
"bottom": "unicopia:blocks/bakery_door_lower",
"top": "unicopia:blocks/bakery_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "unicopia:block/door/top",
"textures": {
"bottom": "unicopia:blocks/door_bakery_lower",
"top": "unicopia:blocks/door_bakery_upper"
"bottom": "unicopia:blocks/bakery_door_lower",
"top": "unicopia:blocks/bakery_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "unicopia:block/door/top_rh",
"textures": {
"bottom": "unicopia:blocks/door_bakery_lower",
"top": "unicopia:blocks/door_bakery_upper"
"bottom": "unicopia:blocks/bakery_door_lower",
"top": "unicopia:blocks/bakery_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "unicopia:block/door/bottom",
"textures": {
"bottom": "unicopia:blocks/door_diamond_lower",
"top": "unicopia:blocks/door_diamond_upper"
"bottom": "unicopia:blocks/diamond_door_lower",
"top": "unicopia:blocks/diamond_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "unicopia:block/door/bottom_rh",
"textures": {
"bottom": "unicopia:blocks/door_diamond_lower",
"top": "unicopia:blocks/door_diamond_upper"
"bottom": "unicopia:blocks/diamond_door_lower",
"top": "unicopia:blocks/diamond_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "unicopia:block/door/top",
"textures": {
"bottom": "unicopia:blocks/door_diamond_lower",
"top": "unicopia:blocks/door_diamond_upper"
"bottom": "unicopia:blocks/diamond_door_lower",
"top": "unicopia:blocks/diamond_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "unicopia:block/door/top_rh",
"textures": {
"bottom": "unicopia:blocks/door_diamond_lower",
"top": "unicopia:blocks/door_diamond_upper"
"bottom": "unicopia:blocks/diamond_door_lower",
"top": "unicopia:blocks/diamond_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "unicopia:block/door/bottom",
"textures": {
"bottom": "unicopia:blocks/door_library_lower",
"top": "unicopia:blocks/door_library_upper"
"bottom": "unicopia:blocks/library_door_lower",
"top": "unicopia:blocks/library_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "unicopia:block/door/bottom_rh",
"textures": {
"bottom": "unicopia:blocks/door_library_lower",
"top": "unicopia:blocks/door_library_upper"
"bottom": "unicopia:blocks/library_door_lower",
"top": "unicopia:blocks/library_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "unicopia:block/door/top",
"textures": {
"bottom": "unicopia:blocks/door_library_lower",
"top": "unicopia:blocks/door_library_upper"
"bottom": "unicopia:blocks/library_door_lower",
"top": "unicopia:blocks/library_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "unicopia:block/door/top_rh",
"textures": {
"bottom": "unicopia:blocks/door_library_lower",
"top": "unicopia:blocks/door_library_upper"
"bottom": "unicopia:blocks/library_door_lower",
"top": "unicopia:blocks/library_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "minecraft:block/door_bottom",
"textures": {
"bottom": "unicopia:blocks/door_mist_lower",
"top": "unicopia:blocks/door_mist_upper"
"bottom": "unicopia:blocks/misted_glass_door_lower",
"top": "unicopia:blocks/misted_glass_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "block/door_bottom_rh",
"textures": {
"bottom": "unicopia:blocks/door_mist_lower",
"top": "unicopia:blocks/door_mist_upper"
"bottom": "unicopia:blocks/misted_glass_door_lower",
"top": "unicopia:blocks/misted_glass_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "block/door_top",
"textures": {
"bottom": "unicopia:blocks/door_mist_lower",
"top": "unicopia:blocks/door_mist_upper"
"bottom": "unicopia:blocks/misted_glass_door_lower",
"top": "unicopia:blocks/misted_glass_door_upper"
}
}

View file

@ -1,7 +1,7 @@
{
"parent": "block/door_top_rh",
"textures": {
"bottom": "unicopia:blocks/door_mist_lower",
"top": "unicopia:blocks/door_mist_upper"
"bottom": "unicopia:blocks/misted_glass_door_lower",
"top": "unicopia:blocks/misted_glass_door_upper"
}
}

View file

@ -1,7 +1,8 @@
{
"parent": "block/cube_column",
"parent": "unicopia:block/chitin_shell_block",
"textures": {
"end": "unicopia:blocks/cloud_enchanted_top",
"side": "unicopia:blocks/cloud_enchanted"
"top": "unicopia:blocks/enchanted_cloud_block_top",
"side": "unicopia:blocks/enchanted_cloud_block",
"bottom": "unicopia:blocks/enchanted_cloud_block_bottom"
}
}

View file

@ -0,0 +1,8 @@
{
"parent": "unicopia:block/chitin_shell_block",
"textures": {
"top": "unicopia:blocks/enchanted_cloud_block_top",
"side": "unicopia:blocks/enchanted_cloud_block_bottom",
"bottom": "unicopia:blocks/enchanted_cloud_block_bottom"
}
}

View file

@ -1,8 +1,8 @@
{
"parent": "block/slab",
"textures": {
"bottom": "unicopia:blocks/cloud_enchanted_top",
"top": "unicopia:blocks/cloud_enchanted",
"side": "unicopia:blocks/cloud_enchanted"
"bottom": "unicopia:blocks/enchanted_cloud_block_bottom",
"top": "unicopia:blocks/enchanted_cloud_block_top",
"side": "unicopia:blocks/enchanted_cloud_slab_side"
}
}

View file

@ -1,8 +1,8 @@
{
"parent": "block/slab_top",
"textures": {
"bottom": "unicopia:blocks/cloud_enchanted",
"top": "unicopia:blocks/cloud_enchanted_top",
"side": "unicopia:blocks/cloud_enchanted"
"bottom": "unicopia:blocks/enchanted_cloud_block_bottom",
"top": "unicopia:blocks/enchanted_cloud_block_top",
"side": "unicopia:blocks/enchanted_cloud_slab_side"
}
}

View file

@ -1,8 +1,8 @@
{
"parent": "block/farmland",
"textures": {
"particle": "unicopia:blocks/cloud_normal",
"dirt": "unicopia:blocks/cloud_normal",
"particle": "unicopia:blocks/cloud_block",
"dirt": "unicopia:blocks/cloud_block",
"top": "unicopia:blocks/cloud_farmland_dry"
}
}

View file

@ -1,8 +1,8 @@
{
"parent": "block/farmland",
"textures": {
"particle": "unicopia:blocks/cloud_normal",
"dirt": "unicopia:blocks/cloud_normal",
"particle": "unicopia:blocks/cloud_block",
"dirt": "unicopia:blocks/cloud_block",
"top": "unicopia:blocks/cloud_farmland_wet"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

View file

@ -0,0 +1,11 @@
{
"animation": {
"frametime": 200,
"frames": [
0, 1, 2, 3,
1, 2, 3, 0,
2, 3, 0, 1,
3, 0, 1, 2
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -9,7 +9,7 @@
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "minecraft:oak_door",
"block": "unicopia:bakery_door",
"properties": {
"half": "lower"
}

View file

@ -9,7 +9,7 @@
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "minecraft:oak_door",
"block": "unicopia:diamond_door",
"properties": {
"half": "lower"
}

View file

@ -9,7 +9,7 @@
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "minecraft:oak_door",
"block": "unicopia:library_door",
"properties": {
"half": "lower"
}

View file

@ -10,5 +10,5 @@
{ "item": "unicopia:cloud_block" }
]
},
"result": { "item": "unicopia:cloud_anvil", "count": 1 }
"result": { "item": "unicopia:cloud_anvil" }
}

View file

@ -9,5 +9,5 @@
{ "item": "unicopia:cloud_matter" }
]
},
"result": { "item": "unicopia:cloud_block", "count": 1 }
"result": { "item": "unicopia:cloud_block" }
}

View file

@ -9,5 +9,5 @@
{ "item": "unicopia:cloud_block" }
]
},
"result": { "item": "unicopia:dense_cloud_block", "count": 1 }
"result": { "item": "unicopia:dense_cloud_block" }
}

View file

@ -1,5 +1,5 @@
{
"type": "minecraft:crafting_shaped",
"type": "unicopia:crafting_shaped",
"pattern": [
"$$$",
"#*#",
@ -15,7 +15,7 @@
"*": [
{
"item": "minecraft:enchanted_book",
"ench": "minecraft:feather_falling"
"enchantment": "minecraft:feather_falling"
}
]
},