Skip to content

Commit

Permalink
set openCameraScreen method in CameraItem to client environment
Browse files Browse the repository at this point in the history
  • Loading branch information
HyperPigeon committed Apr 2, 2022
1 parent bd2374e commit f96f072
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.18.2
yarn_mappings=1.18.2+build.2
loader_version=0.13.3
# Mod Properties
mod_version=1.2.1
mod_version=1.2.2
maven_group=net.hyper_pigeon
archives_base_name=polaroidcamera
# Dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.hyper_pigeon.polaroidcamera.items;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.hyper_pigeon.polaroidcamera.client.render.CameraScreen;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.player.PlayerEntity;
Expand All @@ -21,14 +23,12 @@ public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand han
openCameraScreen(world,user,hand);
return TypedActionResult.success(user.getStackInHand(hand));
}


return TypedActionResult.success(user.getStackInHand(hand));
}

@Environment(EnvType.CLIENT)
private void openCameraScreen(World world, PlayerEntity user, Hand hand) {
MinecraftClient mc = MinecraftClient.getInstance();

if (!(mc.currentScreen instanceof CameraScreen)) {
mc.setScreen(new CameraScreen(mc.options.fov, world));
}
Expand Down

0 comments on commit f96f072

Please sign in to comment.