添加了patch镜子的配方
让patch的镜子可以含水 将patch的镜子添加了tag里
This commit is contained in:
parent
d70ff3229f
commit
a9aaa20bb6
|
|
@ -6,4 +6,4 @@ org.gradle.daemon=false
|
|||
mod.id = modernlifepatch
|
||||
mod.group = com.r3944realms.modernlifepatch
|
||||
mod.author = r3944Realms
|
||||
mod.version = 1.18.2-1.4.1
|
||||
mod.version = 1.18.2-1.4.2
|
||||
|
|
@ -4,7 +4,15 @@ ac9cec2e51193a3ebaa165fe91c9bb3f9f3fcc32 assets/modernlifepatch/models/item/larg
|
|||
de63e31ba044ddc8d09dd10945a560d414e185c4 assets/modernlifepatch/models/item/massive_mirror.json
|
||||
80cb85eae418087ea09e8b0d34289b3faf7f0faf assets/modernlifepatch/models/item/mirror.json
|
||||
ddaaed0180f28afb8dfa1c4270e9872360aca2a7 assets/modernlifepatch/models/item/tall_mirror.json
|
||||
e3b1f573605d846515a967f0dc47f6cc194054ea data/modernlifepatch/advancements/recipes/decorations/large_mirror.json
|
||||
2e19bc218d3414988ba9744dde0065b56d8568f1 data/modernlifepatch/advancements/recipes/decorations/massive_mirror.json
|
||||
5ca06b9db5622369088059c82f7fbd9d6ebdb4e0 data/modernlifepatch/advancements/recipes/decorations/mirror.json
|
||||
f530958baac72ec117593beb583cfb489caaf795 data/modernlifepatch/advancements/recipes/decorations/tall_mirror.json
|
||||
9a71f6635f4ffa1441d5f3120a7423cf2fdc2f1f data/modernlifepatch/loot_tables/blocks/large_mirror.json
|
||||
4d0d15aa540872b16a0d933522a63822564772e6 data/modernlifepatch/loot_tables/blocks/massive_mirror.json
|
||||
0d9ab0fd3bb217e2cba98c4d870a49aad11df4ea data/modernlifepatch/loot_tables/blocks/mirror.json
|
||||
2e8f6832411b91b57fe84a63e0f3fe5c855cf732 data/modernlifepatch/loot_tables/blocks/tall_mirror.json
|
||||
991b44d89265fa18c6eae9d488fe266f992938f2 data/modernlifepatch/recipes/large_mirror.json
|
||||
ab176773d07c8e9d6a798aa814cdc3b47ddc0594 data/modernlifepatch/recipes/massive_mirror.json
|
||||
981f4ada5cbf1c4a387846415a916088ab305059 data/modernlifepatch/recipes/mirror.json
|
||||
520f615353aca735689ae25ba5b9d2a0728f97da data/modernlifepatch/recipes/tall_mirror.json
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"rewards": {
|
||||
"recipes": [
|
||||
"modernlifepatch:large_mirror"
|
||||
]
|
||||
},
|
||||
"criteria": {
|
||||
"has_item_mirror": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"items": [
|
||||
"modernlifepatch:mirror"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"trigger": "minecraft:recipe_unlocked",
|
||||
"conditions": {
|
||||
"recipe": "modernlifepatch:large_mirror"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[
|
||||
"has_item_mirror",
|
||||
"has_the_recipe"
|
||||
]
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"rewards": {
|
||||
"recipes": [
|
||||
"modernlifepatch:massive_mirror"
|
||||
]
|
||||
},
|
||||
"criteria": {
|
||||
"has_item_mirror": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"items": [
|
||||
"modernlifepatch:mirror"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"trigger": "minecraft:recipe_unlocked",
|
||||
"conditions": {
|
||||
"recipe": "modernlifepatch:massive_mirror"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[
|
||||
"has_item_mirror",
|
||||
"has_the_recipe"
|
||||
]
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"rewards": {
|
||||
"recipes": [
|
||||
"modernlifepatch:mirror"
|
||||
]
|
||||
},
|
||||
"criteria": {
|
||||
"has_item_glass_pane": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"tag": "forge:glass_panes"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"trigger": "minecraft:recipe_unlocked",
|
||||
"conditions": {
|
||||
"recipe": "modernlifepatch:mirror"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[
|
||||
"has_item_glass_pane",
|
||||
"has_the_recipe"
|
||||
]
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"rewards": {
|
||||
"recipes": [
|
||||
"modernlifepatch:tall_mirror"
|
||||
]
|
||||
},
|
||||
"criteria": {
|
||||
"has_item_mirror": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"items": [
|
||||
"modernlifepatch:mirror"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"has_the_recipe": {
|
||||
"trigger": "minecraft:recipe_unlocked",
|
||||
"conditions": {
|
||||
"recipe": "modernlifepatch:tall_mirror"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[
|
||||
"has_item_mirror",
|
||||
"has_the_recipe"
|
||||
]
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"@@",
|
||||
"@@"
|
||||
],
|
||||
"key": {
|
||||
"@": {
|
||||
"item": "modernlifepatch:mirror"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "modernlifepatch:large_mirror"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"@@@",
|
||||
"@@@"
|
||||
],
|
||||
"key": {
|
||||
"@": {
|
||||
"item": "modernlifepatch:mirror"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "modernlifepatch:massive_mirror"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shapeless",
|
||||
"ingredients": [
|
||||
{
|
||||
"tag": "forge:glass_panes"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:iron_ingot"
|
||||
},
|
||||
{
|
||||
"tag": "minecraft:wooden_slabs"
|
||||
}
|
||||
],
|
||||
"result": {
|
||||
"item": "modernlifepatch:mirror"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"@",
|
||||
"@"
|
||||
],
|
||||
"key": {
|
||||
"@": {
|
||||
"item": "modernlifepatch:mirror"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "modernlifepatch:tall_mirror"
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,6 @@ import com.r3944realms.modernlifepatch.content.blocks.ModBlocks;
|
|||
import com.r3944realms.modernlifepatch.content.blocks.entities.ModBlockEntityType;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.EntityRenderersEvent;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.r3944realms.modernlifepatch;
|
|||
|
||||
import net.minecraft.server.packs.repository.Pack;
|
||||
import net.minecraft.server.packs.repository.PackSource;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.event.AddPackFindersEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ package com.r3944realms.modernlifepatch.client.renderer.blockentity;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.r3944realms.modernlifepatch.content.blocks.entities.type.mirror.MirrorBlockEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.r3944realms.modernlifepatch.content.blocks.type.mirror.MirrorBlock;
|
|||
import com.r3944realms.modernlifepatch.content.blocks.type.mirror.MirrorPart;
|
||||
import com.r3944realms.modernlifepatch.content.items.ModItems;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
|
@ -27,7 +28,7 @@ public class ModBlocks {
|
|||
() -> new MirrorBlock(BlockBehaviour.Properties.copy(Blocks.GLASS), MirrorPart.MirrorType.MASSIVE_MIRROR));
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public static <T extends Block> RegistryObject<BlockItem> registerBlockItem(String name , RegistryObject<T> block){
|
||||
return ModItems.ITEMS.register(name,() -> new BlockItem(block.get(),new Item.Properties()));
|
||||
return ModItems.ITEMS.register(name,() -> new BlockItem(block.get(),new Item.Properties().tab(CreativeModeTab.TAB_DECORATIONS)));
|
||||
}
|
||||
public static void register(IEventBus bus) {
|
||||
BLOCKS.register(bus);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.r3944realms.modernlifepatch.content.blocks.type.mirror;
|
||||
|
||||
import com.dairymoose.modernlife.blocks.GrateBlock;
|
||||
import com.r3944realms.modernlifepatch.content.blocks.blockstate.ModBlockStateProperties;
|
||||
import com.r3944realms.modernlifepatch.content.blocks.entities.type.mirror.MirrorBlockEntity;
|
||||
import com.r3944realms.modernlifepatch.content.blocks.type.mirror.shape.IMirrorShape;
|
||||
|
|
@ -11,18 +12,16 @@ import net.minecraft.world.entity.LivingEntity;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.EntityBlock;
|
||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||
import net.minecraft.world.level.*;
|
||||
import net.minecraft.world.level.block.*;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
|
|
@ -31,10 +30,12 @@ import org.jetbrains.annotations.NotNull;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public class MirrorBlock extends HorizontalDirectionalBlock implements EntityBlock {
|
||||
public class MirrorBlock extends HorizontalDirectionalBlock implements EntityBlock, SimpleWaterloggedBlock {
|
||||
public static final EnumProperty<MirrorPart> PART = ModBlockStateProperties.MIRROR_PART;
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
public final MirrorPart.MirrorType mirrorType;
|
||||
|
||||
public MirrorBlock(Properties pProperties, MirrorPart.@NotNull MirrorType mirrorType) {
|
||||
|
|
@ -47,7 +48,12 @@ public class MirrorBlock extends HorizontalDirectionalBlock implements EntityBlo
|
|||
case LARGE_MIRROR -> mirrorPart = MirrorPart.FOOT_LEFT;
|
||||
case MASSIVE_MIRROR -> mirrorPart = MirrorPart.F11;
|
||||
}
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(PART, mirrorPart));
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(PART, mirrorPart).setValue(WATERLOGGED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull FluidState getFluidState(@NotNull BlockState pState) {
|
||||
return pState.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : Fluids.EMPTY.defaultFluidState();
|
||||
}
|
||||
|
||||
// 控制是否能够在该放置放置方块, 如果不能满足放置要求则返回null(借鉴于原版的梯子方块)
|
||||
|
|
@ -57,13 +63,13 @@ public class MirrorBlock extends HorizontalDirectionalBlock implements EntityBlo
|
|||
final BlockPos clickedPos = pContext.getClickedPos();
|
||||
final Level level = pContext.getLevel();
|
||||
final Direction horizontalDirection = pContext.getHorizontalDirection();
|
||||
FluidState fluidState$Root = pContext.getLevel().getFluidState(clickedPos);
|
||||
return switch (mirrorType) {
|
||||
case COMMON_MIRROR -> {
|
||||
// 检查后部分是否有合法的支撑方块
|
||||
BlockPos behind = clickedPos.relative(horizontalDirection);
|
||||
|
||||
boolean flag = !level.getBlockState(behind).isAir() && level.getBlockState(behind).isSolidRender(level, behind);
|
||||
yield flag ? this.defaultBlockState().setValue(FACING, horizontalDirection) : null;
|
||||
yield flag ? this.defaultBlockState().setValue(FACING, horizontalDirection).setValue(WATERLOGGED, fluidState$Root.getType() == Fluids.WATER) : null;
|
||||
}
|
||||
case TELL_MIRROR -> {
|
||||
// 检查上部分是不是有阻挡
|
||||
|
|
@ -72,7 +78,7 @@ public class MirrorBlock extends HorizontalDirectionalBlock implements EntityBlo
|
|||
// 检查上部分是否有合法的支撑方块
|
||||
BlockPos relative = above.relative(horizontalDirection);
|
||||
boolean flag2 = !level.getBlockState(relative).isAir() && level.getBlockState(relative).isSolidRender(level, relative);
|
||||
yield flag1 && flag2 ? this.defaultBlockState().setValue(FACING, horizontalDirection) : null;
|
||||
yield flag1 && flag2 ? this.defaultBlockState().setValue(FACING, horizontalDirection).setValue(WATERLOGGED, fluidState$Root.getType() == Fluids.WATER) : null;
|
||||
}
|
||||
case LARGE_MIRROR -> {
|
||||
// 检查空间是否足够2x2
|
||||
|
|
@ -89,7 +95,7 @@ public class MirrorBlock extends HorizontalDirectionalBlock implements EntityBlo
|
|||
boolean flag2 = (!level.getBlockState(headLeftSupport).isAir() && level.getBlockState(headLeftSupport).isSolidRender(level, headLeftSupport)) &&
|
||||
(!level.getBlockState(footRightSupport).isAir() && level.getBlockState(footRightSupport).isSolidRender(level, footRightSupport)) &&
|
||||
(!level.getBlockState(headRightSupport).isAir() && level.getBlockState(headRightSupport).isSolidRender(level, headRightSupport));
|
||||
yield flag1 && flag2 ? this.defaultBlockState().setValue(FACING, horizontalDirection) : null;
|
||||
yield flag1 && flag2 ? this.defaultBlockState().setValue(FACING, horizontalDirection).setValue(WATERLOGGED, fluidState$Root.getType() == Fluids.WATER) : null;
|
||||
}
|
||||
case MASSIVE_MIRROR -> {
|
||||
// 检查空间是否足够2x3
|
||||
|
|
@ -114,7 +120,7 @@ public class MirrorBlock extends HorizontalDirectionalBlock implements EntityBlo
|
|||
(!level.getBlockState(headRightSupport).isAir() && level.getBlockState(headRightSupport).isSolidRender(level, headRightSupport)) &&
|
||||
(!level.getBlockState(headMiddleSupport).isAir() && level.getBlockState(headMiddleSupport).isSolidRender(level, headMiddleSupport)) &&
|
||||
(!level.getBlockState(footLeftSupport).isAir() && level.getBlockState(footLeftSupport).isSolidRender(level, footLeftSupport));
|
||||
yield flag1 && flag2 ? this.defaultBlockState().setValue(FACING, horizontalDirection) : null;
|
||||
yield flag1 && flag2 ? this.defaultBlockState().setValue(FACING, horizontalDirection).setValue(WATERLOGGED, fluidState$Root.getType() == Fluids.WATER) : null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -122,6 +128,9 @@ public class MirrorBlock extends HorizontalDirectionalBlock implements EntityBlo
|
|||
// 控制当方块结构不完整时,破坏另一结构的方块(借鉴于于原版的床破坏逻辑)
|
||||
@Override
|
||||
public @NotNull BlockState updateShape(@NotNull BlockState pState, @NotNull Direction pDirection, @NotNull BlockState pNeighborState, @NotNull LevelAccessor pLevel, @NotNull BlockPos pCurrentPos, @NotNull BlockPos pNeighborPos) {
|
||||
if (pState.getValue(WATERLOGGED)) {
|
||||
pLevel.scheduleTick(pCurrentPos, Fluids.WATER, Fluids.WATER.getTickDelay(pLevel));
|
||||
}
|
||||
final boolean canSelfNotSurvive = !pState.canSurvive(pLevel, pCurrentPos);
|
||||
final Direction facing = pState.getValue(FACING);
|
||||
final MirrorPart part = pState.getValue(PART);
|
||||
|
|
@ -180,11 +189,6 @@ public class MirrorBlock extends HorizontalDirectionalBlock implements EntityBlo
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(@NotNull BlockState pState, LootContext.@NotNull Builder pBuilder) {
|
||||
return super.getDrops(pState, pBuilder);
|
||||
}
|
||||
|
||||
// 控制实体放置一部分方块后,自动放置另一部分(借鉴于于原版的床放置逻辑)
|
||||
@Override
|
||||
public void setPlacedBy(@NotNull Level pLevel, @NotNull BlockPos pPos, @NotNull BlockState pState, @Nullable LivingEntity pPlacer, @NotNull ItemStack pStack) {
|
||||
|
|
@ -192,20 +196,22 @@ public class MirrorBlock extends HorizontalDirectionalBlock implements EntityBlo
|
|||
if(!pLevel.isClientSide) {
|
||||
final Direction facing = pState.getValue(FACING);
|
||||
switch (mirrorType) {
|
||||
|
||||
case COMMON_MIRROR -> {
|
||||
//NOOP
|
||||
|
||||
}
|
||||
case TELL_MIRROR -> {
|
||||
BlockPos blockpos = pPos.above();
|
||||
pLevel.setBlock(blockpos, pState.setValue(PART, MirrorPart.HEAD), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(blockpos, pState.setValue(PART, MirrorPart.HEAD).setValue(WATERLOGGED, pLevel.getFluidState(blockpos).getType() == Fluids.WATER), Block.UPDATE_ALL);
|
||||
pLevel.blockUpdated(pPos, Blocks.AIR);
|
||||
pState.updateNeighbourShapes(pLevel, pPos, Block.UPDATE_ALL);
|
||||
pState.updateNeighbourShapes(pLevel, pPos, Block.UPDATE_ALL);
|
||||
}
|
||||
case LARGE_MIRROR -> {
|
||||
BlockPos headLeft = pPos.above(), footRight = pPos.relative(facing.getCounterClockWise().getOpposite()), headRight = footRight.above();
|
||||
pLevel.setBlock(headLeft, pState.setValue(PART, MirrorPart.HEAD_LEFT), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(footRight, pState.setValue(PART, MirrorPart.FOOT_RIGHT), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(headRight, pState.setValue(PART, MirrorPart.HEAD_RIGHT), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(headLeft, pState.setValue(PART, MirrorPart.HEAD_LEFT).setValue(WATERLOGGED, pLevel.getFluidState(headLeft).getType() == Fluids.WATER), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(footRight, pState.setValue(PART, MirrorPart.FOOT_RIGHT).setValue(WATERLOGGED, pLevel.getFluidState(footRight).getType() == Fluids.WATER), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(headRight, pState.setValue(PART, MirrorPart.HEAD_RIGHT).setValue(WATERLOGGED, pLevel.getFluidState(headRight).getType() == Fluids.WATER), Block.UPDATE_ALL);
|
||||
pLevel.blockUpdated(pPos, Blocks.AIR);
|
||||
pState.updateNeighbourShapes(pLevel, pPos, Block.UPDATE_ALL);
|
||||
}
|
||||
|
|
@ -215,11 +221,11 @@ public class MirrorBlock extends HorizontalDirectionalBlock implements EntityBlo
|
|||
f12 = pPos.relative(facing.getCounterClockWise().getOpposite()),
|
||||
h00 = f10.above(),
|
||||
h02 = f12.above();
|
||||
pLevel.setBlock(h00, pState.setValue(PART, MirrorPart.H00), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(f10, pState.setValue(PART, MirrorPart.F10), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(h01, pState.setValue(PART, MirrorPart.H01), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(f12, pState.setValue(PART, MirrorPart.F12), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(h02, pState.setValue(PART, MirrorPart.H02), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(h00, pState.setValue(PART, MirrorPart.H00).setValue(WATERLOGGED, pLevel.getFluidState(h00).getType() == Fluids.WATER), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(f10, pState.setValue(PART, MirrorPart.F10).setValue(WATERLOGGED, pLevel.getFluidState(f10).getType() == Fluids.WATER), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(h01, pState.setValue(PART, MirrorPart.H01).setValue(WATERLOGGED, pLevel.getFluidState(h01).getType() == Fluids.WATER), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(f12, pState.setValue(PART, MirrorPart.F12).setValue(WATERLOGGED, pLevel.getFluidState(f12).getType() == Fluids.WATER), Block.UPDATE_ALL);
|
||||
pLevel.setBlock(h02, pState.setValue(PART, MirrorPart.H02).setValue(WATERLOGGED, pLevel.getFluidState(h02).getType() == Fluids.WATER), Block.UPDATE_ALL);
|
||||
pLevel.blockUpdated(pPos, Blocks.AIR);
|
||||
pState.updateNeighbourShapes(pLevel, pPos, Block.UPDATE_ALL);
|
||||
}
|
||||
|
|
@ -330,27 +336,8 @@ public class MirrorBlock extends HorizontalDirectionalBlock implements EntityBlo
|
|||
return this.canAttachTo(pLevel, pPos.relative(direction), direction);
|
||||
}
|
||||
|
||||
public void playerWillDestroy(Level pLevel, BlockPos pPos, BlockState pState, Player pPlayer) {
|
||||
if (!pLevel.isClientSide ) {
|
||||
final MirrorPart part = pState.getValue(PART);
|
||||
switch (mirrorType) {
|
||||
case COMMON_MIRROR -> {
|
||||
//NOOP
|
||||
}
|
||||
case TELL_MIRROR -> {
|
||||
|
||||
}
|
||||
case LARGE_MIRROR -> {
|
||||
}
|
||||
case MASSIVE_MIRROR -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
super.playerWillDestroy(pLevel, pPos, pState, pPlayer);
|
||||
}
|
||||
|
||||
protected void createBlockStateDefinition(StateDefinition.@NotNull Builder<Block, BlockState> pBuilder) {
|
||||
pBuilder.add(FACING, PART);
|
||||
pBuilder.add(FACING, PART, WATERLOGGED);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public class DataGeneratorHandler {
|
|||
generator.addProvider(new ModLanguageProvider(generator, LanguageEnum.SimpleChinese));
|
||||
generator.addProvider(new ModItemModelProvider(generator, existingFileHelper));
|
||||
generator.addProvider(new ModBlockModelProvider(generator, existingFileHelper));
|
||||
generator.addProvider(new ModRecipeProvider(generator));
|
||||
generator.addProvider(new ModLootTabProvider(generator));
|
||||
generator.addProvider(modBlockTagProvider);
|
||||
generator.addProvider(new ModItemTagProvider(generator, modBlockTagProvider, existingFileHelper));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.r3944realms.modernlifepatch.utils.String.StringValidator;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum ModLangKeyValue {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.r3944realms.modernlifepatch.datagen.provider;
|
||||
|
||||
import com.r3944realms.modernlifepatch.content.items.ModItems;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.data.recipes.RecipeProvider;
|
||||
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ModRecipeProvider extends RecipeProvider {
|
||||
public ModRecipeProvider(DataGenerator pGenerator) {
|
||||
super(pGenerator);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildCraftingRecipes(@NotNull Consumer<FinishedRecipe> pFinishedRecipeConsumer) {
|
||||
ShapelessRecipeBuilder.shapeless(ModItems.MIRROR_ITEM.get(), 1)
|
||||
.requires(Tags.Items.GLASS_PANES)
|
||||
.requires(Items.IRON_INGOT)
|
||||
.requires(ItemTags.WOODEN_SLABS)
|
||||
.unlockedBy("has_item_glass_pane", has(Tags.Items.GLASS_PANES))
|
||||
.save(pFinishedRecipeConsumer);
|
||||
ShapedRecipeBuilder.shaped(ModItems.TALL_MIRROR_ITEM.get(), 1)
|
||||
.define('@', ModItems.MIRROR_ITEM.get())
|
||||
.pattern("@")
|
||||
.pattern("@")
|
||||
.unlockedBy("has_item_mirror", has(ModItems.MIRROR_ITEM.get()))
|
||||
.save(pFinishedRecipeConsumer);
|
||||
ShapedRecipeBuilder.shaped(ModItems.LARGE_MIRROR_ITEM.get(), 1)
|
||||
.define('@', ModItems.MIRROR_ITEM.get())
|
||||
.pattern("@@")
|
||||
.pattern("@@")
|
||||
.unlockedBy("has_item_mirror", has(ModItems.MIRROR_ITEM.get()))
|
||||
.save(pFinishedRecipeConsumer);
|
||||
ShapedRecipeBuilder.shaped(ModItems.MASSIVE_MIRROR_ITEM.get(), 1)
|
||||
.define('@', ModItems.MIRROR_ITEM.get())
|
||||
.pattern("@@@")
|
||||
.pattern("@@@")
|
||||
.unlockedBy("has_item_mirror", has(ModItems.MIRROR_ITEM.get()))
|
||||
.save(pFinishedRecipeConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,9 +1,14 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"modernlife:mirror",
|
||||
"modernlife:tall_mirror",
|
||||
"modernlife:large_mirror",
|
||||
"modernlife:massive_mirror",
|
||||
"modernlifepatch:mirror",
|
||||
"modernlifepatch:tall_mirror",
|
||||
"modernlifepatch:large_mirror",
|
||||
"modernlifepatch:massive_mirror",
|
||||
"modernlife:shower_head",
|
||||
"modernlife:bathroom_ceramic_tile",
|
||||
"modernlife:washing_machine",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user