Skip to content

Commit

Permalink
client only
Browse files Browse the repository at this point in the history
  • Loading branch information
wefcdse committed May 20, 2024
1 parent 76227fc commit 895933e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.15.6
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.7

# Mod Properties
mod_version=1.1.8
maven_group=com.iung.fpv20
archives_base_name=fpv20

# Dependencies
fabric_version=0.91.0+1.20.1
fabric_version=0.96.11+1.20.4


# https://maven.wispforest.io/io/wispforest/owo-lib/
owo_version=0.11.2+1.20


#systemProp.http.proxyHost=127.0.0.1
#systemProp.http.proxyPort=28081
#systemProp.https.proxyHost=127.0.0.1
#systemProp.https.proxyPort=28081
#
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=28081
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=28081
4 changes: 3 additions & 1 deletion src/main/java/com/iung/fpv20/Fpv20.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public void onInitialize() {
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.

if (config.client_only) {
return;
}
// LOGGER.info("Hello Fabric world!");
ModBlocks.registerModBlocks();
ModItemGroups.registerItemGroups();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/iung/fpv20/config/Fpv20ConfigCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Fpv20ConfigCommon {

private float step_height = 1.2f;
private boolean is_in_forge = false;
public boolean client_only = false;

public boolean in_forge() {
return this.is_in_forge;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/iung/fpv20/consts/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import net.minecraft.util.Identifier;

public class ModBlocks {
public static Identifier RECEIVER_BLOCK_ID = new Identifier(Fpv20.MOD_ID, "receiver_block");
public static final Block RECEIVER_BLOCK = registerBlock(RECEIVER_BLOCK_ID, new ReceiverBlock(FabricBlockSettings.copyOf(Blocks.REDSTONE_BLOCK)));
public static Identifier RECEIVER_BLOCK_ID = Fpv20.config.client_only ? null : new Identifier(Fpv20.MOD_ID, "receiver_block");
public static final Block RECEIVER_BLOCK = Fpv20.config.client_only ? null : registerBlock(RECEIVER_BLOCK_ID, new ReceiverBlock(FabricBlockSettings.copyOf(Blocks.REDSTONE_BLOCK)));

public static final BlockEntityType<ReceiverBlockEntity> RECEIVER_BLOCK_ENTITY = Registry.register(
public static final BlockEntityType<ReceiverBlockEntity> RECEIVER_BLOCK_ENTITY = Fpv20.config.client_only ? null : Registry.register(
Registries.BLOCK_ENTITY_TYPE,
new Identifier(Fpv20.MOD_ID, "receiver_block_entity"),
FabricBlockEntityTypeBuilder.create(ReceiverBlockEntity::new, RECEIVER_BLOCK).build()
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/com/iung/fpv20/consts/ModItemGroups.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@

public class ModItemGroups {

public static final ItemGroup RUBY_GROUP = Registry.register(Registries.ITEM_GROUP,
new Identifier(Fpv20.MOD_ID,"ruby"),
public static final ItemGroup RUBY_GROUP = Fpv20.config.client_only ? null : Registry.register(Registries.ITEM_GROUP,
new Identifier(Fpv20.MOD_ID, "ruby"),
FabricItemGroup.builder().displayName(Text.literal("FPV20"))
.icon(()->new ItemStack(ModBlocks.RECEIVER_BLOCK.asItem())).entries((displayContext, entries) -> {
.icon(() -> new ItemStack(ModBlocks.RECEIVER_BLOCK.asItem())).entries((displayContext, entries) -> {
entries.add(ModBlocks.RECEIVER_BLOCK);

}).build());
public static void registerItemGroups(){

public static void registerItemGroups() {
Fpv20.LOGGER.info("Registering Item Group for " + Fpv20.MOD_ID);
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/iung/fpv20/consts/ScreenHandlers.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@

public class ScreenHandlers {
public static final ScreenHandlerType<ReceiverBlockHandler> RECEIVER_SCREEN_HANDLER;

static {
RECEIVER_SCREEN_HANDLER = Registry.register(Registries.SCREEN_HANDLER, ModBlocks.RECEIVER_BLOCK_ID,
RECEIVER_SCREEN_HANDLER = Fpv20.config.client_only ? null : Registry.register(Registries.SCREEN_HANDLER, ModBlocks.RECEIVER_BLOCK_ID,
new ExtendedScreenHandlerType<>(ReceiverBlockHandler::new));

}

public static void reg(){
public static void reg() {

}
}

0 comments on commit 895933e

Please sign in to comment.