Skip to content

Commit 15f1167

Browse files
committed
Fix server crashing issue due to PlantAnalyzer
1 parent 4902575 commit 15f1167

File tree

9 files changed

+30
-119
lines changed

9 files changed

+30
-119
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ mod_name=Smokeleaf Industries
3636
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
3737
mod_license=MIT
3838
# The mod version. See https://semver.org/
39-
mod_version=0.5.0-1.21.1
39+
mod_version=0.5.1-1.21.1
4040

4141
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
4242
# This should match the base package used for the mod sources.

src/main/java/net/micaxs/smokeleaf/SmokeleafIndustries.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ public SmokeleafIndustries(IEventBus modEventBus, ModContainer modContainer) {
7474

7575
ModVillagers.register(modEventBus);
7676

77-
// Register the item to a creative tab
78-
modEventBus.addListener(this::addCreative);
79-
8077
modEventBus.register(ModPayloads.class);
8178

8279
// Register our mod's ModConfigSpec so that FML can create and load the config file for us
@@ -104,12 +101,6 @@ private void commonSetup(FMLCommonSetupEvent event) {
104101

105102
}
106103

107-
// Add the example block item to the building blocks tab
108-
private void addCreative(BuildCreativeModeTabContentsEvent event) {
109-
110-
}
111-
112-
113104
@SubscribeEvent
114105
public void onServerStarting(ServerStartingEvent event) {
115106
LOGGER.info("Smokeleaf Industries server starting...");

src/main/java/net/micaxs/smokeleaf/block/custom/GrowPotBlock.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import net.minecraft.world.phys.BlockHitResult;
3535
import net.minecraft.world.phys.shapes.CollisionContext;
3636
import net.minecraft.world.phys.shapes.VoxelShape;
37+
import net.neoforged.api.distmarker.Dist;
38+
import net.neoforged.api.distmarker.OnlyIn;
3739
import org.jetbrains.annotations.Nullable;
3840

3941
import java.util.List;
@@ -107,8 +109,8 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev
107109
boolean sneaking = player.isShiftKeyDown();
108110

109111
if (holdingMagnifyingGlass) {
110-
if (level.isClientSide()) {
111-
Minecraft.getInstance().setScreen(new MagnifyingGlassScreen(pos));
112+
if (level.isClientSide) {
113+
openAnalyzerScreen(pos);
112114
}
113115
return ItemInteractionResult.SUCCESS;
114116
}
@@ -183,6 +185,13 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev
183185
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
184186
}
185187

188+
189+
@OnlyIn(Dist.CLIENT)
190+
public static void openAnalyzerScreen(BlockPos pos) {
191+
Minecraft.getInstance().setScreen(new MagnifyingGlassScreen(pos));
192+
}
193+
194+
186195
@Override
187196
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hit) {
188197
return InteractionResult.PASS;

src/main/java/net/micaxs/smokeleaf/block/entity/GrinderBlockEntity.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package net.micaxs.smokeleaf.block.entity;
22

33
import net.micaxs.smokeleaf.block.entity.energy.ModEnergyStorage;
4-
import net.micaxs.smokeleaf.block.entity.energy.ModEnergyUtil;
54
import net.micaxs.smokeleaf.component.ModDataComponentTypes;
6-
import net.micaxs.smokeleaf.item.ModItems;
75
import net.micaxs.smokeleaf.item.custom.BaseBudItem;
86
import net.micaxs.smokeleaf.recipe.GrinderRecipe;
97
import net.micaxs.smokeleaf.recipe.GrinderRecipeInput;

src/main/java/net/micaxs/smokeleaf/effect/neutral/GigglyFitEffect.java

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/main/java/net/micaxs/smokeleaf/item/custom/PlantAnalyzerItem.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import net.minecraft.world.item.context.UseOnContext;
1616
import net.minecraft.world.level.Level;
1717
import net.minecraft.world.level.block.state.BlockState;
18+
import net.neoforged.api.distmarker.Dist;
19+
import net.neoforged.api.distmarker.OnlyIn;
1820

1921
import java.util.List;
2022

@@ -36,13 +38,19 @@ public InteractionResult useOn(UseOnContext context) {
3638
return InteractionResult.PASS;
3739
}
3840

39-
if (level.isClientSide()) {
40-
Minecraft.getInstance().setScreen(new MagnifyingGlassScreen(pos));
41+
if (level.isClientSide) {
42+
openAnalyzerScreen(pos);
4143
}
4244

4345
return InteractionResult.sidedSuccess(level.isClientSide());
4446
}
4547

48+
@OnlyIn(Dist.CLIENT)
49+
public static void openAnalyzerScreen(BlockPos pos) {
50+
Minecraft.getInstance().setScreen(new MagnifyingGlassScreen(pos));
51+
}
52+
53+
4654
@Override
4755
public void appendHoverText(ItemStack stack, TooltipContext context, List<Component> tooltipComponents, TooltipFlag tooltipFlag) {
4856
tooltipComponents.add(Component.translatable("tooltip.smokeleafindustries.plant_analyzer").withStyle(ChatFormatting.GRAY));

src/main/java/net/micaxs/smokeleaf/network/GigglyFitClientHandler.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/main/java/net/micaxs/smokeleaf/network/ModPayloads.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ public static void register(final RegisterPayloadHandlersEvent event) {
1313
.versioned("1")
1414
.optional();
1515

16-
// GigglyFit -> client
17-
registrar.playToClient(
18-
GigglyFitPayload.TYPE,
19-
GigglyFitPayload.STREAM_CODEC,
20-
GigglyFitClientHandler::handle
21-
);
22-
2316
// Paranoia Hallucination -> client
2417
registrar.playToClient(
2518
ParanoiaHallucinationPayload.TYPE,

src/main/java/net/micaxs/smokeleaf/screen/ModMenuTypes.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
package net.micaxs.smokeleaf.screen;
22

33
import net.micaxs.smokeleaf.SmokeleafIndustries;
4-
import net.micaxs.smokeleaf.screen.custom.*;
4+
import net.micaxs.smokeleaf.screen.custom.GeneratorMenu;
5+
import net.micaxs.smokeleaf.screen.custom.GrinderMenu;
6+
import net.micaxs.smokeleaf.screen.custom.ExtractorMenu;
7+
import net.micaxs.smokeleaf.screen.custom.LiquifierMenu;
8+
import net.micaxs.smokeleaf.screen.custom.MutatorMenu;
9+
import net.micaxs.smokeleaf.screen.custom.SynthesizerMenu;
10+
import net.micaxs.smokeleaf.screen.custom.SequencerMenu;
11+
import net.micaxs.smokeleaf.screen.custom.DryerMenu;
512
import net.minecraft.core.registries.BuiltInRegistries;
613
import net.minecraft.world.inventory.AbstractContainerMenu;
714
import net.minecraft.world.inventory.MenuType;

0 commit comments

Comments
 (0)