diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockBookshelf.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockBookshelf.java index f5db453b6..103133814 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockBookshelf.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockBookshelf.java @@ -4,6 +4,7 @@ import com.github.tartaricacid.touhoulittlemaid.tileentity.TileEntityBookshelf; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.pathfinding.PathType; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; @@ -41,4 +42,9 @@ public TileEntity createTileEntity(BlockState state, IBlockReader world) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return SHAPE; } + + @Override + public boolean isPathfindable(BlockState state, IBlockReader worldIn, BlockPos pos, PathType type) { + return false; + } } diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockGomoku.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockGomoku.java index 05bd9ad6c..b34c9c0e1 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockGomoku.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockGomoku.java @@ -20,6 +20,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; +import net.minecraft.pathfinding.PathType; import net.minecraft.state.DirectionProperty; import net.minecraft.state.EnumProperty; import net.minecraft.state.StateContainer; @@ -335,4 +336,9 @@ public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, return CENTER; } } + + @Override + public boolean isPathfindable(BlockState state, IBlockReader worldIn, BlockPos pos, PathType type) { + return false; + } } diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockKeyboard.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockKeyboard.java index ee3b31fe1..ac4ff4506 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockKeyboard.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockKeyboard.java @@ -4,6 +4,7 @@ import com.github.tartaricacid.touhoulittlemaid.tileentity.TileEntityKeyboard; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.pathfinding.PathType; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; @@ -41,4 +42,9 @@ public TileEntity createTileEntity(BlockState state, IBlockReader world) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return SHAPE; } + + @Override + public boolean isPathfindable(BlockState state, IBlockReader worldIn, BlockPos pos, PathType type) { + return false; + } } diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockShrine.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockShrine.java index 647f2ef4f..dfbf19fdf 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockShrine.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/block/BlockShrine.java @@ -41,6 +41,11 @@ public BlockShrine() { this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH)); } + @Override + public boolean hasTileEntity(BlockState state) { + return true; + } + @Override protected void createBlockStateDefinition(StateContainer.Builder builder) { builder.add(FACING); diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/gui/block/MaidBeaconGui.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/gui/block/MaidBeaconGui.java index 00ea4a285..e01f7ab60 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/gui/block/MaidBeaconGui.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/gui/block/MaidBeaconGui.java @@ -95,7 +95,7 @@ private void addEffectButton(int start, int spacing, int y) { public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { this.renderBackground(matrixStack); getMinecraft().textureManager.bind(BG); - blit(matrixStack, leftPos, topPos, 0, 0, imageWidth, imageHeight); + blit(matrixStack, leftPos, topPos, 0, 0, 142, 111); blit(matrixStack, leftPos, topPos + 2, 0, 0, 142, 111); blit(matrixStack, leftPos + 118, topPos + 1, 44, 111, 154, 15); diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/model/GomokuModel.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/model/GomokuModel.java index 73215079c..45173f7ef 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/model/GomokuModel.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/model/GomokuModel.java @@ -23,7 +23,7 @@ public GomokuModel() { main.texOffs(0, 0).addBox(-16.0F, -2.0F, -16.0F, 32.0F, 2.0F, 32.0F, 0.0F, false); blackBox = new ModelRenderer(this); - blackBox.setPos(0.0F, 24.0F, 0.0F); + blackBox.setPos(0.0F, 24.0F, -21.0F); blackBox.texOffs(69, 11).addBox(-22.0F, -1.0F, 8.0F, 5.0F, 1.0F, 5.0F, 0.0F, false); blackBox.texOffs(12, 99).addBox(-21.5F, -2.95F, 8.5F, 4.0F, 1.0F, 4.0F, 0.0F, false); blackBox.texOffs(12, 99).addBox(-20.25F, -3.85F, 8.9F, 2.0F, 1.0F, 2.0F, -0.25F, false); @@ -40,7 +40,7 @@ public GomokuModel() { bone2.texOffs(12, 99).addBox(-1.0F, -0.5F, -1.0F, 2.0F, 1.0F, 2.0F, -0.25F, false); whiteBox = new ModelRenderer(this); - whiteBox.setPos(0.0F, 24.0F, 0.0F); + whiteBox.setPos(0.0F, 24.0F, 21.0F); whiteBox.texOffs(69, 11).addBox(17.0F, -1.0F, -13.0F, 5.0F, 1.0F, 5.0F, 0.0F, true); whiteBox.texOffs(44, 96).addBox(17.5F, -2.95F, -12.5F, 4.0F, 1.0F, 4.0F, 0.0F, true); whiteBox.texOffs(44, 96).addBox(18.25F, -3.85F, -10.9F, 2.0F, 1.0F, 2.0F, -0.25F, true); diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/model/PieceModel.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/model/PieceModel.java index 68e001572..34863eb8c 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/model/PieceModel.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/model/PieceModel.java @@ -15,7 +15,7 @@ public PieceModel() { main = new ModelRenderer(this); main.setPos(0.0F, 24.0F, 0.0F); - main.texOffs(0, 0).addBox(-1.0F, -1.0F, -1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false); + main.texOffs(0, 0).addBox(-1.0F, -1.0F, -1.0F, 2.0F, 1.0F, 2.0F, -0.25F, false); } @Override diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/tileentity/TileEntityGomokuRenderer.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/tileentity/TileEntityGomokuRenderer.java index a66a74565..bf6e96dc5 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/tileentity/TileEntityGomokuRenderer.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/tileentity/TileEntityGomokuRenderer.java @@ -8,7 +8,6 @@ import com.github.tartaricacid.touhoulittlemaid.tileentity.TileEntityGomoku; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; @@ -31,11 +30,9 @@ public class TileEntityGomokuRenderer extends TileEntityRenderer= 2; + return cropState.is(Blocks.COCOA) && cropState.getValue(CocoaBlock.AGE) >= 2; } @Override @@ -74,7 +74,7 @@ public void harvest(EntityMaid maid, BlockPos cropPos, BlockState cropState) { public boolean canPlant(EntityMaid maid, BlockPos basePos, BlockState baseState, ItemStack seed) { basePos = basePos.above(); baseState = maid.level.getBlockState(basePos); - if (baseState.is(Blocks.JUNGLE_LOG) && seed.getItem() == Items.COCOA_BEANS) { + if (baseState.is(BlockTags.JUNGLE_LOGS) && seed.getItem() == Items.COCOA_BEANS) { for (Direction direction : Direction.Plane.HORIZONTAL) { BlockState state = maid.level.getBlockState(basePos.relative(direction)); if (state.getMaterial().isReplaceable()) { diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/event/EntityJoinWorldEvent.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/event/ChangeEntityAiEvent.java similarity index 85% rename from src/main/java/com/github/tartaricacid/touhoulittlemaid/event/EntityJoinWorldEvent.java rename to src/main/java/com/github/tartaricacid/touhoulittlemaid/event/ChangeEntityAiEvent.java index 582d981f2..41eee0441 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/event/EntityJoinWorldEvent.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/event/ChangeEntityAiEvent.java @@ -6,13 +6,14 @@ import net.minecraft.entity.ai.goal.TemptGoal; import net.minecraft.entity.monster.CreeperEntity; import net.minecraft.entity.passive.AnimalEntity; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber -public class EntityJoinWorldEvent { +public class ChangeEntityAiEvent { @SubscribeEvent - public static void onCreeperJoinWorld(net.minecraftforge.event.entity.EntityJoinWorldEvent event) { + public static void onCreeperJoinWorld(EntityJoinWorldEvent event) { if (event.getEntity() instanceof CreeperEntity) { CreeperEntity creeper = (CreeperEntity) event.getEntity(); creeper.goalSelector.addGoal(1, new AvoidEntityGoal<>(creeper, EntityMaid.class, 6, 1, 1.2)); @@ -20,7 +21,7 @@ public static void onCreeperJoinWorld(net.minecraftforge.event.entity.EntityJoin } @SubscribeEvent - public static void onAnimalJoinWorld(net.minecraftforge.event.entity.EntityJoinWorldEvent event) { + public static void onAnimalJoinWorld(EntityJoinWorldEvent event) { if (event.getEntity() instanceof AnimalEntity) { AnimalEntity animal = (AnimalEntity) event.getEntity(); animal.goalSelector.availableGoals.stream().filter(goal -> goal.getGoal() instanceof TemptGoal).findFirst().ifPresent(g -> { diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/event/MaidChunkEvent.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/event/MaidChunkEvent.java deleted file mode 100644 index 05e73fda1..000000000 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/event/MaidChunkEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.github.tartaricacid.touhoulittlemaid.event; - -import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid; -import com.github.tartaricacid.touhoulittlemaid.world.data.MaidWorldData; -import net.minecraft.entity.Entity; -import net.minecraftforge.event.entity.EntityJoinWorldEvent; -import net.minecraftforge.event.entity.EntityLeaveWorldEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; - - -@Mod.EventBusSubscriber -public class MaidChunkEvent { - @SubscribeEvent - public static void onMaidJoinWorld(EntityJoinWorldEvent event) { - Entity entity = event.getEntity(); - if (entity instanceof EntityMaid && ((EntityMaid) entity).getOwnerUUID() != null) { - EntityMaid maid = (EntityMaid) entity; - MaidWorldData data = MaidWorldData.get(maid.level); - if (data != null) { - data.removeInfo(maid); - } - } - } - - @SubscribeEvent - public static void onMaidLevelWorld(EntityLeaveWorldEvent event) { - Entity entity = event.getEntity(); - if (entity instanceof EntityMaid && !entity.level.isClientSide && entity.isAlive() && ((EntityMaid) entity).getOwnerUUID() != null) { - EntityMaid maid = (EntityMaid) entity; - MaidWorldData data = MaidWorldData.get(maid.level); - if (data != null) { - data.addInfo(maid); - } - } - } -} diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/event/TravelToDimensionEvent.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/event/TravelToDimensionEvent.java deleted file mode 100644 index 7755a5121..000000000 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/event/TravelToDimensionEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.github.tartaricacid.touhoulittlemaid.event; - -import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid; -import com.github.tartaricacid.touhoulittlemaid.util.TeleportHelper; -import net.minecraft.potion.EffectInstance; -import net.minecraft.potion.Effects; -import net.minecraftforge.event.entity.EntityTravelToDimensionEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; - -@Mod.EventBusSubscriber -public class TravelToDimensionEvent { - private static final int MAX_RETRY = 16; - - @SubscribeEvent - public static void onTravelToDimension(EntityTravelToDimensionEvent event) { - if (event.getEntity() instanceof EntityMaid) { - EntityMaid maid = (EntityMaid) event.getEntity(); - for (int i = 0; i < MAX_RETRY; ++i) { - if (TeleportHelper.teleport(maid)) { - maid.addEffect(new EffectInstance(Effects.GLOWING, 200, 1, true, false)); - event.setCanceled(true); - return; - } - } - } - } -} diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/init/InitItems.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/init/InitItems.java index 7a72d1194..a3a518d2e 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/init/InitItems.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/init/InitItems.java @@ -19,6 +19,9 @@ public final class InitItems { public static RegistryObject MAID_BACKPACK_SMALL = ITEMS.register("maid_backpack_small", ItemMaidBackpack::new); public static RegistryObject MAID_BACKPACK_MIDDLE = ITEMS.register("maid_backpack_middle", ItemMaidBackpack::new); public static RegistryObject MAID_BACKPACK_BIG = ITEMS.register("maid_backpack_big", ItemMaidBackpack::new); + public static RegistryObject CRAFTING_TABLE_BACKPACK = ITEMS.register("crafting_table_backpack", ItemMaidBackpack::new); + public static RegistryObject ENDER_CHEST_BACKPACK = ITEMS.register("ender_chest_backpack", ItemMaidBackpack::new); + public static RegistryObject FURNACE_BACKPACK = ITEMS.register("furnace_backpack", ItemMaidBackpack::new); public static RegistryObject CHAIR = ITEMS.register("chair", ItemChair::new); public static RegistryObject HAKUREI_GOHEI = ITEMS.register("hakurei_gohei", ItemHakureiGohei::new); public static RegistryObject MAID_BED = ITEMS.register("maid_bed", ItemMaidBed::new); @@ -49,12 +52,9 @@ public final class InitItems { public static RegistryObject MAID_BEACON = ITEMS.register("maid_beacon", ItemMaidBeacon::new); public static RegistryObject MODEL_SWITCHER = ITEMS.register("model_switcher", ItemModelSwitcher::new); public static RegistryObject CHAIR_SHOW = ITEMS.register("chair_show", ItemChairShow::new); - public static RegistryObject GOMOKU = ITEMS.register("gomoku", () -> new BlockItem(InitBlocks.GOMOKU.get(), new Item.Properties().tab(MAIN_TAB))); public static RegistryObject RED_FOX_SCROLL = ITEMS.register("red_fox_scroll", ItemFoxScroll::new); public static RegistryObject WHITE_FOX_SCROLL = ITEMS.register("white_fox_scroll", ItemFoxScroll::new); - public static RegistryObject CRAFTING_TABLE_BACKPACK = ITEMS.register("crafting_table_backpack", ItemMaidBackpack::new); - public static RegistryObject ENDER_CHEST_BACKPACK = ITEMS.register("ender_chest_backpack", ItemMaidBackpack::new); - public static RegistryObject FURNACE_BACKPACK = ITEMS.register("furnace_backpack", ItemMaidBackpack::new); + public static RegistryObject GOMOKU = ITEMS.register("gomoku", () -> new BlockItem(InitBlocks.GOMOKU.get(), new Item.Properties().tab(MAIN_TAB))); public static RegistryObject KEYBOARD = ITEMS.register("keyboard", () -> new BlockItem(InitBlocks.KEYBOARD.get(), new Item.Properties().tab(MAIN_TAB))); public static RegistryObject BOOKSHELF = ITEMS.register("bookshelf", () -> new BlockItem(InitBlocks.BOOKSHELF.get(), new Item.Properties().tab(MAIN_TAB))); public static RegistryObject COMPUTER = ITEMS.register("computer", () -> new BlockItem(InitBlocks.COMPUTER.get(), new Item.Properties().tab(MAIN_TAB))); diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/inventory/container/MaidMainContainer.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/inventory/container/MaidMainContainer.java index 478bb43a8..77d5e2eac 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/inventory/container/MaidMainContainer.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/inventory/container/MaidMainContainer.java @@ -37,7 +37,6 @@ public MaidMainContainer(ContainerType type, int id, PlayerInventory inventor this.addMaidBauble(); this.addMaidHandInv(); this.addMainDefaultInv(); - this.addMainDefaultInv(); this.addBackpackInv(inventory); } } diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/inventory/container/backpack/CraftingTableBackpackContainer.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/inventory/container/backpack/CraftingTableBackpackContainer.java index c740fd17c..8315588a7 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/inventory/container/backpack/CraftingTableBackpackContainer.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/inventory/container/backpack/CraftingTableBackpackContainer.java @@ -45,7 +45,7 @@ public CraftingTableBackpackContainer(int id, PlayerInventory inventory, int ent @Override public void slotsChanged(IInventory container) { - this.access.execute((level, blockPos) -> slotChangedCraftingGrid(containerId, level, this.player, this.craftSlots, this.resultSlots)); + this.access.execute((level, blockPos) -> slotChangedCraftingGrid(this.containerId, level, this.player, this.craftSlots, this.resultSlots)); } @Override @@ -122,7 +122,7 @@ protected void slotChangedCraftingGrid(int menuId, World level, PlayerEntity pla } } result.setItem(0, itemStack); - serverPlayer.connection.send(new SSetSlotPacket(menuId, 0, itemStack)); + serverPlayer.connection.send(new SSetSlotPacket(menuId, resultSlot.index, itemStack)); } } } diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/item/ItemSmartSlab.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/item/ItemSmartSlab.java index 40844304a..f1703d513 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/item/ItemSmartSlab.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/item/ItemSmartSlab.java @@ -134,6 +134,7 @@ private ActionResultType spawnNewMaid(ItemUseContext context, PlayerEntity playe if (worldIn instanceof ServerWorld) { maid.finalizeSpawn((ServerWorld) worldIn, worldIn.getCurrentDifficultyAt(context.getClickedPos()), SpawnReason.SPAWN_EGG, null, null); + maid.moveTo(context.getClickedPos().above(), 0, 0); worldIn.addFreshEntity(maid); } maid.spawnExplosionParticle(); diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/network/message/MaidConfigMessage.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/network/message/MaidConfigMessage.java index d99a2a9f1..40c3004b6 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/network/message/MaidConfigMessage.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/network/message/MaidConfigMessage.java @@ -1,6 +1,7 @@ package com.github.tartaricacid.touhoulittlemaid.network.message; import com.github.tartaricacid.touhoulittlemaid.entity.ai.brain.MaidSchedule; +import com.github.tartaricacid.touhoulittlemaid.entity.item.EntitySit; import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid; import net.minecraft.entity.Entity; import net.minecraft.entity.player.ServerPlayerEntity; @@ -47,10 +48,16 @@ public static void handle(MaidConfigMessage message, Supplier