Added fancy beds and bedsheets

This commit is contained in:
Sollace 2023-10-31 20:38:28 +00:00
parent ff6d24e25f
commit 05a5960380
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
45 changed files with 327 additions and 57 deletions

View file

@ -0,0 +1,121 @@
package com.minelittlepony.unicopia.block;
import java.util.Locale;
import com.minelittlepony.unicopia.item.BedsheetsItem;
import net.minecraft.block.BedBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BedBlockEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.enums.BedPart;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.DyeColor;
import net.minecraft.util.StringIdentifiable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
public class FancyBedBlock extends BedBlock {
private final String base;
public FancyBedBlock(String base, Settings settings) {
super(DyeColor.WHITE, settings);
this.base = base;
}
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new Tile(pos, state);
}
public static void setBedPattern(World world, BlockPos pos, SheetPattern pattern) {
world.getBlockEntity(pos, UBlockEntities.FANCY_BED).ifPresent(tile -> {
ItemStack stack = BedsheetsItem.forPattern(tile.getPattern()).getDefaultStack();
if (!stack.isEmpty()) {
Block.dropStack(world, pos, stack);
}
tile.setPattern(pattern);
BlockState state = tile.getCachedState();
BlockPos other = pos.offset(getDirectionTowardsOtherPart(state.get(PART), state.get(FACING)));
world.getBlockEntity(other, UBlockEntities.FANCY_BED).ifPresent(tile2 -> {
tile2.setPattern(pattern);
});
});
}
private static Direction getDirectionTowardsOtherPart(BedPart part, Direction direction) {
return part == BedPart.FOOT ? direction : direction.getOpposite();
}
public static class Tile extends BedBlockEntity {
private SheetPattern pattern = SheetPattern.NONE;
public Tile(BlockPos pos, BlockState state) {
super(pos, state);
}
@Override
public BlockEntityType<?> getType() {
return UBlockEntities.FANCY_BED;
}
@Override
public void readNbt(NbtCompound nbt) {
pattern = SheetPattern.byId(nbt.getString("pattern"));
}
@Override
protected void writeNbt(NbtCompound nbt) {
nbt.putString("pattern", pattern.asString());
}
@Override
public NbtCompound toInitialChunkDataNbt() {
return createNbt();
}
public String getBase() {
return ((FancyBedBlock)getCachedState().getBlock()).base;
}
public void setPattern(SheetPattern pattern) {
this.pattern = pattern;
markDirty();
}
public SheetPattern getPattern() {
return pattern;
}
}
public enum SheetPattern implements StringIdentifiable {
NONE,
APPLE,
BARS,
BLUE,
CHECKER,
ORANGE,
PINK,
RAINBOW;
@SuppressWarnings("deprecation")
public static final Codec<SheetPattern> CODEC = StringIdentifiable.createCodec(SheetPattern::values);
private final String name = name().toLowerCase(Locale.ROOT);
@Override
public String asString() {
return name;
}
@SuppressWarnings("deprecation")
public static SheetPattern byId(String id) {
return CODEC.byId(id, NONE);
}
}
}

View file

@ -10,7 +10,7 @@ import net.minecraft.registry.Registries;
public interface UBlockEntities { public interface UBlockEntities {
BlockEntityType<WeatherVaneBlock.WeatherVane> WEATHER_VANE = create("weather_vane", BlockEntityType.Builder.create(WeatherVaneBlock.WeatherVane::new, UBlocks.WEATHER_VANE)); BlockEntityType<WeatherVaneBlock.WeatherVane> WEATHER_VANE = create("weather_vane", BlockEntityType.Builder.create(WeatherVaneBlock.WeatherVane::new, UBlocks.WEATHER_VANE));
BlockEntityType<CloudBedBlock.Tile> CLOUD_BED = create("cloud_bed", BlockEntityType.Builder.create(CloudBedBlock.Tile::new, UBlocks.WHITE_CLOUD_BED, UBlocks.ORANGE_CLOUD_BED)); BlockEntityType<CloudBedBlock.Tile> FANCY_BED = create("fancy_bed", BlockEntityType.Builder.create(CloudBedBlock.Tile::new, UBlocks.CLOTH_BED, UBlocks.CLOUD_BED));
static <T extends BlockEntity> BlockEntityType<T> create(String id, Builder<T> builder) { static <T extends BlockEntity> BlockEntityType<T> create(String id, Builder<T> builder) {
return Registry.register(Registries.BLOCK_ENTITY_TYPE, id, builder.build(null)); return Registry.register(Registries.BLOCK_ENTITY_TYPE, id, builder.build(null));

View file

@ -30,7 +30,6 @@ import net.minecraft.block.enums.Instrument;
import net.minecraft.block.piston.PistonBehavior; import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
@ -175,8 +174,8 @@ public interface UBlocks {
Block CARVED_CLOUD = register("carved_cloud", new OrientedCloudBlock(Settings.copy(CLOUD).hardness(0.4F).requiresTool(), false), ItemGroups.BUILDING_BLOCKS); Block CARVED_CLOUD = register("carved_cloud", new OrientedCloudBlock(Settings.copy(CLOUD).hardness(0.4F).requiresTool(), false), ItemGroups.BUILDING_BLOCKS);
Block UNSTABLE_CLOUD = register("unstable_cloud", new UnstableCloudBlock(Settings.copy(CLOUD)), ItemGroups.NATURAL); Block UNSTABLE_CLOUD = register("unstable_cloud", new UnstableCloudBlock(Settings.copy(CLOUD)), ItemGroups.NATURAL);
Block CLOUD_PILLAR = register("cloud_pillar", new CloudPillarBlock(Settings.create().mapColor(MapColor.GRAY).hardness(0.5F).resistance(0).sounds(BlockSoundGroup.WOOL)), ItemGroups.NATURAL); Block CLOUD_PILLAR = register("cloud_pillar", new CloudPillarBlock(Settings.create().mapColor(MapColor.GRAY).hardness(0.5F).resistance(0).sounds(BlockSoundGroup.WOOL)), ItemGroups.NATURAL);
Block WHITE_CLOUD_BED = register("white_cloud_bed", new CloudBedBlock(DyeColor.WHITE, CLOUD.getDefaultState(), Settings.copy(Blocks.WHITE_BED).sounds(BlockSoundGroup.WOOL))); Block CLOTH_BED = register("cloth_bed", new FancyBedBlock("cloth", Settings.copy(Blocks.WHITE_BED).sounds(BlockSoundGroup.WOOL)));
Block ORANGE_CLOUD_BED = register("orange_cloud_bed", new CloudBedBlock(DyeColor.ORANGE, CLOUD.getDefaultState(), Settings.copy(Blocks.ORANGE_BED).sounds(BlockSoundGroup.WOOL))); Block CLOUD_BED = register("cloud_bed", new CloudBedBlock("cloud", CLOUD.getDefaultState(), Settings.copy(Blocks.WHITE_BED).sounds(BlockSoundGroup.WOOL)));
private static <T extends Block> T register(String name, T item) { private static <T extends Block> T register(String name, T item) {
return register(Unicopia.id(name), item); return register(Unicopia.id(name), item);

View file

@ -3,20 +3,14 @@ package com.minelittlepony.unicopia.block.cloud;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.minelittlepony.unicopia.EquineContext; import com.minelittlepony.unicopia.EquineContext;
import com.minelittlepony.unicopia.block.UBlockEntities; import com.minelittlepony.unicopia.block.FancyBedBlock;
import net.minecraft.block.BedBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext; import net.minecraft.block.ShapeContext;
import net.minecraft.block.entity.BedBlockEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.ai.pathing.NavigationType; import net.minecraft.entity.ai.pathing.NavigationType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -25,12 +19,12 @@ import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
public class CloudBedBlock extends BedBlock { public class CloudBedBlock extends FancyBedBlock {
private final BlockState baseState; private final BlockState baseState;
private final CloudBlock baseBlock; private final CloudBlock baseBlock;
public CloudBedBlock(DyeColor color, BlockState baseState, Settings settings) { public CloudBedBlock(String base, BlockState baseState, Settings settings) {
super(color, settings); super(base, settings);
this.baseState = baseState; this.baseState = baseState;
this.baseBlock = (CloudBlock)baseState.getBlock(); this.baseBlock = (CloudBlock)baseState.getBlock();
} }
@ -83,20 +77,4 @@ public class CloudBedBlock extends BedBlock {
public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) { public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) {
return true; return true;
} }
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new Tile(pos, state);
}
public static class Tile extends BedBlockEntity {
public Tile(BlockPos pos, BlockState state) {
super(pos, state);
}
@Override
public BlockEntityType<?> getType() {
return UBlockEntities.CLOUD_BED;
}
}
} }

View file

@ -1,5 +1,7 @@
package com.minelittlepony.unicopia.client; package com.minelittlepony.unicopia.client;
import java.util.function.Supplier;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.Unicopia;
@ -24,7 +26,6 @@ import com.minelittlepony.unicopia.entity.mob.UEntities;
import com.minelittlepony.unicopia.item.ChameleonItem; import com.minelittlepony.unicopia.item.ChameleonItem;
import com.minelittlepony.unicopia.item.EnchantableItem; import com.minelittlepony.unicopia.item.EnchantableItem;
import com.minelittlepony.unicopia.item.UItems; import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.item.cloud.CloudBedItem;
import com.minelittlepony.unicopia.particle.UParticles; import com.minelittlepony.unicopia.particle.UParticles;
import com.terraformersmc.terraform.boat.api.client.TerraformBoatClientHelper; import com.terraformersmc.terraform.boat.api.client.TerraformBoatClientHelper;
@ -35,6 +36,7 @@ import net.fabricmc.fabric.api.client.rendering.v1.*;
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry.DynamicItemRenderer; import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry.DynamicItemRenderer;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.color.world.BiomeColors; import net.minecraft.client.color.world.BiomeColors;
import net.minecraft.client.color.world.FoliageColors; import net.minecraft.client.color.world.FoliageColors;
@ -92,10 +94,10 @@ public interface URenderers {
EntityRendererRegistry.register(UEntities.FRIENDLY_CREEPER, FriendlyCreeperEntityRenderer::new); EntityRendererRegistry.register(UEntities.FRIENDLY_CREEPER, FriendlyCreeperEntityRenderer::new);
BlockEntityRendererFactories.register(UBlockEntities.WEATHER_VANE, WeatherVaneBlockEntityRenderer::new); BlockEntityRendererFactories.register(UBlockEntities.WEATHER_VANE, WeatherVaneBlockEntityRenderer::new);
BlockEntityRendererFactories.register(UBlockEntities.CLOUD_BED, CloudBedBlockEntityRenderer::new); BlockEntityRendererFactories.register(UBlockEntities.FANCY_BED, CloudBedBlockEntityRenderer::new);
register(URenderers::renderJarItem, UItems.FILLED_JAR); register(URenderers::renderJarItem, UItems.FILLED_JAR);
register(URenderers::renderBedItem, UItems.WHITE_CLOUD_BED, UItems.ORANGE_CLOUD_BED); register(URenderers::renderBedItem, UItems.CLOTH_BED, UItems.CLOUD_BED);
PolearmRenderer.register(UItems.WOODEN_POLEARM, UItems.STONE_POLEARM, UItems.IRON_POLEARM, UItems.GOLDEN_POLEARM, UItems.DIAMOND_POLEARM, UItems.NETHERITE_POLEARM); PolearmRenderer.register(UItems.WOODEN_POLEARM, UItems.STONE_POLEARM, UItems.IRON_POLEARM, UItems.GOLDEN_POLEARM, UItems.DIAMOND_POLEARM, UItems.NETHERITE_POLEARM);
ModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("affinity"), (stack, world, entity, seed) -> EnchantableItem.isEnchanted(stack) ? EnchantableItem.getSpellKey(stack).getAffinity().getAlignment() : 0); ModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("affinity"), (stack, world, entity, seed) -> EnchantableItem.isEnchanted(stack) ? EnchantableItem.getSpellKey(stack).getAffinity().getAlignment() : 0);
ModelPredicateProviderRegistry.register(UItems.ROCK_CANDY, new Identifier("count"), (stack, world, entity, seed) -> stack.getCount() / (float)stack.getMaxCount()); ModelPredicateProviderRegistry.register(UItems.ROCK_CANDY, new Identifier("count"), (stack, world, entity, seed) -> stack.getCount() / (float)stack.getMaxCount());
@ -122,8 +124,9 @@ public interface URenderers {
} }
} }
@SuppressWarnings("unchecked")
private static void renderBedItem(ItemStack stack, ModelTransformationMode mode, MatrixStack matrices, VertexConsumerProvider vertices, int light, int overlay) { private static void renderBedItem(ItemStack stack, ModelTransformationMode mode, MatrixStack matrices, VertexConsumerProvider vertices, int light, int overlay) {
MinecraftClient.getInstance().getBlockEntityRenderDispatcher().renderEntity(((CloudBedItem)stack.getItem()).getRenderEntity(), matrices, vertices, light, overlay); MinecraftClient.getInstance().getBlockEntityRenderDispatcher().renderEntity(((Supplier<BlockEntity>)stack.getItem()).get(), matrices, vertices, light, overlay);
} }
private static void renderJarItem(ItemStack stack, ModelTransformationMode mode, MatrixStack matrices, VertexConsumerProvider vertices, int light, int overlay) { private static void renderJarItem(ItemStack stack, ModelTransformationMode mode, MatrixStack matrices, VertexConsumerProvider vertices, int light, int overlay) {

View file

@ -18,6 +18,7 @@ import net.minecraft.client.model.ModelPartBuilder;
import net.minecraft.client.model.ModelPartData; import net.minecraft.client.model.ModelPartData;
import net.minecraft.client.model.ModelTransform; import net.minecraft.client.model.ModelTransform;
import net.minecraft.client.model.TexturedModelData; import net.minecraft.client.model.TexturedModelData;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
@ -64,10 +65,18 @@ public class CloudBedBlockEntityRenderer implements BlockEntityRenderer<CloudBed
public void render(CloudBedBlock.Tile entity, float f, MatrixStack matrices, VertexConsumerProvider vertices, int light, int overlay) { public void render(CloudBedBlock.Tile entity, float f, MatrixStack matrices, VertexConsumerProvider vertices, int light, int overlay) {
@Nullable @Nullable
World world = entity.getWorld(); World world = entity.getWorld();
Identifier texture = Unicopia.id("textures/entity/cloud_bed/" + entity.getColor().asString() + ".png"); Identifier texture = Unicopia.id("textures/entity/bed/" + entity.getBase() + ".png");
CloudBedBlock.SheetPattern pattern = entity.getPattern();
Identifier sheetsTexture = Unicopia.id("textures/entity/bed/sheets/" + entity.getPattern().asString() + ".png");
if (world == null) { if (world == null) {
renderModel(matrices, vertices, bedHead, Direction.SOUTH, texture, light, overlay, false); renderModel(matrices, vertices, bedHead, Direction.SOUTH, texture, light, overlay, false);
renderModel(matrices, vertices, bedFoot, Direction.SOUTH, texture, light, overlay, true); renderModel(matrices, vertices, bedFoot, Direction.SOUTH, texture, light, overlay, true);
if (pattern != CloudBedBlock.SheetPattern.NONE) {
renderModel(matrices, vertices, bedHead, Direction.SOUTH, sheetsTexture, light, overlay, false);
renderModel(matrices, vertices, bedFoot, Direction.SOUTH, sheetsTexture, light, overlay, true);
}
return; return;
} }
@ -81,6 +90,17 @@ public class CloudBedBlockEntityRenderer implements BlockEntityRenderer<CloudBed
overlay, overlay,
false false
); );
if (pattern != CloudBedBlock.SheetPattern.NONE) {
//MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers().draw();
renderModel(matrices, vertices,
state.get(BedBlock.PART) == BedPart.HEAD ? bedHead : bedFoot,
state.get(BedBlock.FACING),
sheetsTexture,
getModelLight(entity, light),
overlay,
false
);
}
} }
private int getModelLight(CloudBedBlock.Tile entity, int worldLight) { private int getModelLight(CloudBedBlock.Tile entity, int worldLight) {
@ -99,9 +119,14 @@ public class CloudBedBlockEntityRenderer implements BlockEntityRenderer<CloudBed
matrices.translate(0, 0.5625f, translate ? -1 : 0); matrices.translate(0, 0.5625f, translate ? -1 : 0);
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90)); matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90));
matrices.translate(0.5f, 0.5f, 0.5f); matrices.translate(0.5f, 0.5f, 0.5f);
if (texture.getPath().indexOf("sheet") != -1) {
float beddingScale = 1.0001F;
matrices.scale(beddingScale, beddingScale, beddingScale);
}
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(180 + direction.asRotation())); matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(180 + direction.asRotation()));
matrices.translate(-0.5f, -0.5f, -0.5f); matrices.translate(-0.5f, -0.5f, -0.5f);
part.render(matrices, vertices.getBuffer(RenderLayers.getEntityTranslucent(texture)), light, overlay); RenderLayer layer = RenderLayers.getEntityTranslucent(texture);
part.render(matrices, vertices.getBuffer(layer), light, overlay);
matrices.pop(); matrices.pop();
} }
} }

View file

@ -0,0 +1,52 @@
package com.minelittlepony.unicopia.item;
import java.util.HashMap;
import java.util.Map;
import com.minelittlepony.unicopia.block.FancyBedBlock;
import com.minelittlepony.unicopia.block.cloud.CloudBedBlock;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.item.Items;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BedsheetsItem extends Item {
private static final Map<CloudBedBlock.SheetPattern, Item> ITEMS = new HashMap<>();
private final CloudBedBlock.SheetPattern pattern;
public static Item forPattern(CloudBedBlock.SheetPattern pattern) {
return ITEMS.getOrDefault(pattern, Items.AIR);
}
public BedsheetsItem(CloudBedBlock.SheetPattern pattern, Settings settings) {
super(settings);
this.pattern = pattern;
ITEMS.put(pattern, this);
}
@Override
public ActionResult useOnBlock(ItemUsageContext context) {
World world = context.getWorld();
BlockPos pos = context.getBlockPos();
BlockState state = world.getBlockState(pos);
if (state.getBlock() instanceof FancyBedBlock) {
FancyBedBlock.setBedPattern(world, context.getBlockPos(), pattern);
context.getStack().decrement(1);
PlayerEntity player = context.getPlayer();
world.playSound(player, pos, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, SoundCategory.BLOCKS, 1, 1);
return ActionResult.success(world.isClient);
}
return ActionResult.PASS;
}
}

View file

@ -0,0 +1,26 @@
package com.minelittlepony.unicopia.item;
import java.util.function.Supplier;
import com.google.common.base.Suppliers;
import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.BedItem;
import net.minecraft.util.math.BlockPos;
public class FancyBedItem extends BedItem implements Supplier<BlockEntity> {
private final Supplier<BlockEntity> renderEntity;
public FancyBedItem(Block block, Settings settings) {
super(block, settings);
this.renderEntity = Suppliers.memoize(() -> ((BlockEntityProvider)block).createBlockEntity(BlockPos.ORIGIN, block.getDefaultState()));
}
@Override
public BlockEntity get() {
return renderEntity.get();
}
}

View file

@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMultimap;
import com.minelittlepony.unicopia.*; import com.minelittlepony.unicopia.*;
import com.minelittlepony.unicopia.block.UBlocks; import com.minelittlepony.unicopia.block.UBlocks;
import com.minelittlepony.unicopia.block.UWoodTypes; import com.minelittlepony.unicopia.block.UWoodTypes;
import com.minelittlepony.unicopia.block.cloud.CloudBedBlock;
import com.minelittlepony.unicopia.entity.mob.AirBalloonEntity; import com.minelittlepony.unicopia.entity.mob.AirBalloonEntity;
import com.minelittlepony.unicopia.entity.mob.UEntities; import com.minelittlepony.unicopia.entity.mob.UEntities;
import com.minelittlepony.unicopia.item.cloud.CloudBedItem; import com.minelittlepony.unicopia.item.cloud.CloudBedItem;
@ -160,6 +161,14 @@ public interface UItems {
Item GIANT_BALLOON = register("giant_balloon", new HotAirBalloonItem(new Item.Settings().maxCount(1)), ItemGroups.TOOLS); Item GIANT_BALLOON = register("giant_balloon", new HotAirBalloonItem(new Item.Settings().maxCount(1)), ItemGroups.TOOLS);
Item APPLE_BED_SHEETS = register("apple_bed_sheets", new BedsheetsItem(CloudBedBlock.SheetPattern.APPLE, new Item.Settings().maxCount(1)), ItemGroups.FUNCTIONAL);
Item BARRED_BED_SHEETS = register("barred_bed_sheets", new BedsheetsItem(CloudBedBlock.SheetPattern.BARS, new Item.Settings().maxCount(1)), ItemGroups.FUNCTIONAL);
Item BLUE_BED_SHEETS = register("blue_bed_sheets", new BedsheetsItem(CloudBedBlock.SheetPattern.BLUE, new Item.Settings().maxCount(1)), ItemGroups.FUNCTIONAL);
Item CHECKERED_BED_SHEETS = register("checkered_bed_sheets", new BedsheetsItem(CloudBedBlock.SheetPattern.CHECKER, new Item.Settings().maxCount(1)), ItemGroups.FUNCTIONAL);
Item ORANGE_BED_SHEETS = register("orange_bed_sheets", new BedsheetsItem(CloudBedBlock.SheetPattern.ORANGE, new Item.Settings().maxCount(1)), ItemGroups.FUNCTIONAL);
Item PINK_BED_SHEETS = register("pink_bed_sheets", new BedsheetsItem(CloudBedBlock.SheetPattern.PINK, new Item.Settings().maxCount(1)), ItemGroups.FUNCTIONAL);
Item RAINBOW_BED_SHEETS = register("rainbow_bed_sheets", new BedsheetsItem(CloudBedBlock.SheetPattern.RAINBOW, new Item.Settings().maxCount(1)), ItemGroups.FUNCTIONAL);
AmuletItem PEGASUS_AMULET = register("pegasus_amulet", new PegasusAmuletItem(new FabricItemSettings() AmuletItem PEGASUS_AMULET = register("pegasus_amulet", new PegasusAmuletItem(new FabricItemSettings()
.maxCount(1) .maxCount(1)
.maxDamage(890) .maxDamage(890)
@ -177,10 +186,9 @@ public interface UItems {
GlassesItem SUNGLASSES = register("sunglasses", new GlassesItem(new FabricItemSettings().maxCount(1)), ItemGroups.COMBAT); GlassesItem SUNGLASSES = register("sunglasses", new GlassesItem(new FabricItemSettings().maxCount(1)), ItemGroups.COMBAT);
GlassesItem BROKEN_SUNGLASSES = register("broken_sunglasses", new GlassesItem(new FabricItemSettings().maxCount(1)), ItemGroups.COMBAT); GlassesItem BROKEN_SUNGLASSES = register("broken_sunglasses", new GlassesItem(new FabricItemSettings().maxCount(1)), ItemGroups.COMBAT);
Item CARAPACE = register("carapace", new Item(new Item.Settings()), ItemGroups.INGREDIENTS); Item CARAPACE = register("carapace", new Item(new Item.Settings()), ItemGroups.INGREDIENTS);
Item WHITE_CLOUD_BED = register("white_cloud_bed", new CloudBedItem(UBlocks.WHITE_CLOUD_BED, new Item.Settings().maxCount(1)), ItemGroups.FUNCTIONAL); Item CLOTH_BED = register("cloth_bed", new FancyBedItem(UBlocks.CLOTH_BED, new Item.Settings().maxCount(1)), ItemGroups.FUNCTIONAL);
Item ORANGE_CLOUD_BED = register("orange_cloud_bed", new CloudBedItem(UBlocks.ORANGE_CLOUD_BED, new Item.Settings().maxCount(1)), ItemGroups.FUNCTIONAL); Item CLOUD_BED = register("cloud_bed", new CloudBedItem(UBlocks.CLOUD_BED, new Item.Settings().maxCount(1)), ItemGroups.FUNCTIONAL);
Item ALICORN_BADGE = register(Race.ALICORN); Item ALICORN_BADGE = register(Race.ALICORN);
Item PEGASUS_BADGE = register(Race.PEGASUS); Item PEGASUS_BADGE = register(Race.PEGASUS);

View file

@ -11,7 +11,7 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
public class CloudBedItem extends CloudBlockItem { public class CloudBedItem extends CloudBlockItem implements Supplier<BlockEntity> {
private final Supplier<BlockEntity> renderEntity; private final Supplier<BlockEntity> renderEntity;
@ -25,7 +25,8 @@ public class CloudBedItem extends CloudBlockItem {
return context.getWorld().setBlockState(context.getBlockPos(), state, Block.NOTIFY_LISTENERS | Block.REDRAW_ON_MAIN_THREAD | Block.FORCE_STATE); return context.getWorld().setBlockState(context.getBlockPos(), state, Block.NOTIFY_LISTENERS | Block.REDRAW_ON_MAIN_THREAD | Block.FORCE_STATE);
} }
public BlockEntity getRenderEntity() { @Override
public BlockEntity get() {
return renderEntity.get(); return renderEntity.get();
} }
} }

View file

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "unicopia:block/cloth_bed" }
}
}

View file

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "unicopia:block/cloud_bed" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "unicopia:block/orange_cloud_bed" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "unicopia:block/white_cloud_bed" }
}
}

View file

@ -176,6 +176,14 @@
"item.unicopia.music_disc_funk": "Music Disc", "item.unicopia.music_disc_funk": "Music Disc",
"item.unicopia.music_disc_funk.desc": "funk, just funk", "item.unicopia.music_disc_funk.desc": "funk, just funk",
"item.unicopia.apple_bed_sheets": "Apple Patterned Bed Sheets",
"item.unicopia.barred_bed_sheets": "Bar Patterned Bed Sheets",
"item.unicopia.blue_bed_sheets": "Blue Bed Sheets",
"item.unicopia.checkered_bed_sheets": "Checker Patterned Bed Sheets",
"item.unicopia.orange_bed_sheets": "Orange Bed Sheets",
"item.unicopia.pink_bed_sheets": "Pink Bed Sheets",
"item.unicopia.rainbow_bed_sheets": "Rainbow Patterned Bed Sheets",
"block.unicopia.rocks": "Rocks", "block.unicopia.rocks": "Rocks",
"block.unicopia.bananas": "Bananas", "block.unicopia.bananas": "Bananas",
"block.unicopia.zapling": "Zapling", "block.unicopia.zapling": "Zapling",
@ -253,6 +261,7 @@
"block.unicopia.dense_cloud_slab": "Dense Cloud Slab", "block.unicopia.dense_cloud_slab": "Dense Cloud Slab",
"block.unicopia.dense_cloud_stairs": "Dense Cloud Stairs", "block.unicopia.dense_cloud_stairs": "Dense Cloud Stairs",
"block.unicopia.cloud_pillar": "Cloud Pillar", "block.unicopia.cloud_pillar": "Cloud Pillar",
"block.unicopia.cloth_bed": "Fancy Cloth Bed",
"block.unicopia.cloud_bed": "Cloud Bed", "block.unicopia.cloud_bed": "Cloud Bed",
"block.unicopia.oats": "Oats", "block.unicopia.oats": "Oats",

View file

@ -0,0 +1,5 @@
{
"textures": {
"particle": "minecraft:block/white_wool"
}
}

View file

@ -1,5 +0,0 @@
{
"textures": {
"particle": "unicopia:block/cloud"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/apple_bed_sheets"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/barred_bed_sheets"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/blue_bed_sheets"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/checkered_bed_sheets"
}
}

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:item/template_bed", "parent": "minecraft:item/template_bed",
"textures": { "textures": {
"particle": "minecraft:item/orange_wool" "particle": "minecraft:item/white_wool"
} }
} }

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/orange_bed_sheets"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/pink_bed_sheets"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/rainbow_bed_sheets"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/apple_bed_sheets"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB