aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2020-10-28 19:03:32 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2020-10-28 19:03:32 +0100
commit5199c9876f42dcd2bf9818ccdaa072bc2b4426fd (patch)
treeec43441824f54edde24fe789c048578137a77927 /src/main
parentce9ace2a7ac7709d8af5324e5b3dffed19c13ba3 (diff)
downloadparquet-5199c9876f42dcd2bf9818ccdaa072bc2b4426fd.tar.gz
ParquetSettings as static final in Parquet
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/re/jag/parquet/CustomStats.java2
-rw-r--r--src/main/java/re/jag/parquet/Parquet.java6
-rw-r--r--src/main/java/re/jag/parquet/mixin/AbstractTraderEntityMixin.java2
-rw-r--r--src/main/java/re/jag/parquet/mixin/StatisticsS2CPacketMixin.java4
4 files changed, 6 insertions, 8 deletions
diff --git a/src/main/java/re/jag/parquet/CustomStats.java b/src/main/java/re/jag/parquet/CustomStats.java
index f3a65d6..a8fca45 100644
--- a/src/main/java/re/jag/parquet/CustomStats.java
+++ b/src/main/java/re/jag/parquet/CustomStats.java
@@ -11,7 +11,7 @@ public class CustomStats {
public static StatType<Item> TRADED;
public static void register_custom_stats() {
- if(Parquet.get_settings().stats_villager_trades) TRADED = register_type("traded", Registry.ITEM);
+ if(Parquet.settings.stats_villager_trades) TRADED = register_type("traded", Registry.ITEM);
}
private static Identifier register(String _identifier, StatFormatter _formatter) {
diff --git a/src/main/java/re/jag/parquet/Parquet.java b/src/main/java/re/jag/parquet/Parquet.java
index c5cb6a4..4907b3c 100644
--- a/src/main/java/re/jag/parquet/Parquet.java
+++ b/src/main/java/re/jag/parquet/Parquet.java
@@ -21,7 +21,7 @@ import re.jag.parquet.dispenser.*;
public class Parquet implements ModInitializer {
public static final Logger LOG = LogManager.getLogger();
- private static ParquetSettings settings;
+ public static final ParquetSettings settings = new ParquetSettings("parquet.properties");
@Override
public void onInitialize() {
@@ -39,15 +39,13 @@ public class Parquet implements ModInitializer {
}
public static void onBootstrap() {
- settings = new ParquetSettings("parquet.properties");
+ //settings = new ParquetSettings("parquet.properties");
CustomStats.register_custom_stats();
if (settings.dispenser_custom_behavior) register_dispenser_behavior();
}
- public static ParquetSettings get_settings(){return settings;}
-
private static void register_dispenser_behavior() {
//This is a rather hacky implementation
DispenserBlock.registerBehavior(Blocks.SHULKER_BOX.asItem(), new ShulkerPlacementDispenserBehavior());
diff --git a/src/main/java/re/jag/parquet/mixin/AbstractTraderEntityMixin.java b/src/main/java/re/jag/parquet/mixin/AbstractTraderEntityMixin.java
index 56c4c2c..c6a9e2e 100644
--- a/src/main/java/re/jag/parquet/mixin/AbstractTraderEntityMixin.java
+++ b/src/main/java/re/jag/parquet/mixin/AbstractTraderEntityMixin.java
@@ -19,7 +19,7 @@ public class AbstractTraderEntityMixin {
@Inject(method="trade", at = @At("RETURN"))
private void onTrade(TradeOffer tradeOffer, CallbackInfo ci) {
- if ( Parquet.get_settings().stats_villager_trades && this.customer instanceof ServerPlayerEntity) {
+ if ( Parquet.settings.stats_villager_trades && this.customer instanceof ServerPlayerEntity) {
((ServerPlayerEntity)customer).incrementStat( CustomStats.TRADED.getOrCreateStat( tradeOffer.getMutableSellItem().getItem() ) );
}
}
diff --git a/src/main/java/re/jag/parquet/mixin/StatisticsS2CPacketMixin.java b/src/main/java/re/jag/parquet/mixin/StatisticsS2CPacketMixin.java
index 173edcb..ae9dd61 100644
--- a/src/main/java/re/jag/parquet/mixin/StatisticsS2CPacketMixin.java
+++ b/src/main/java/re/jag/parquet/mixin/StatisticsS2CPacketMixin.java
@@ -29,7 +29,7 @@ public class StatisticsS2CPacketMixin {
*/
@Inject(method="write", at=@At("HEAD"), cancellable = true)
protected void onWrite(PacketByteBuf buf, CallbackInfo ci){
- if (Parquet.get_settings().stats_send_to_client)
+ if (Parquet.settings.stats_send_to_client)
return;
Object2IntMap<Stat<?>> copy = ((Object2IntOpenHashMap)stats).clone();
@@ -40,7 +40,7 @@ public class StatisticsS2CPacketMixin {
Object2IntMap.Entry<Stat<?>> entry = (Object2IntMap.Entry)iter.next();
Stat<?> stat = (Stat)entry.getKey();
- if( Parquet.get_settings().stats_villager_trades && stat.getType() == CustomStats.TRADED )
+ if( Parquet.settings.stats_villager_trades && stat.getType() == CustomStats.TRADED )
copy.removeInt(stat);
}