Skip to content

Commit

Permalink
Remove compat for older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
LordDeatHunter committed Jun 7, 2022
1 parent 63d16f2 commit 605b2db
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 301 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ minecraft_version=1.19
yarn_mappings=1.19+build.1
loader_version=0.14.6
# Mod Properties
mod_version=2.6.0
maven_group=wraith.waystones-convert
archives_base_name=wraith-waystones-convert
mod_version=3.0.0
maven_group=wraith.waystones
archives_base_name=wraith-waystones
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.55.1+1.19
Expand Down
27 changes: 0 additions & 27 deletions src/main/java/wraith/fwaystones/mixin/IdentifierMixin.java

This file was deleted.

16 changes: 3 additions & 13 deletions src/main/java/wraith/fwaystones/mixin/PlayerEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public NbtCompound toTagW(NbtCompound tag) {
customTag.putBoolean("view_discovered_waystones", this.viewDiscoveredWaystones);
customTag.putBoolean("view_global_waystones", this.viewGlobalWaystones);

tag.put("fwaystones", customTag);
tag.put(FabricWaystones.MOD_ID, customTag);
return tag;
}

Expand All @@ -216,20 +216,10 @@ public void readCustomDataFromNbt(NbtCompound tag, CallbackInfo ci) {

@Override
public void fromTagW(NbtCompound tag) {
// if (!tag.contains(FabricWaystones.MOD_ID)) {
// return;
// }
// TODO: Remove compat stuff
String tagId;
if (tag.contains("waystones")) {
tagId = "waystones";
} else if (tag.contains("fwaystones")) {
tagId = "fwaystones";
} else {
if (!tag.contains(FabricWaystones.MOD_ID)) {
return;
}
tag = tag.getCompound(tagId);
// end compat stuff
tag = tag.getCompound(FabricWaystones.MOD_ID);
if (tag.contains("discovered_waystones")) {
discoveredWaystones.clear();
WaystoneEvents.FORGET_ALL_WAYSTONES_EVENT.invoker().onForgetAll(_this());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import wraith.fwaystones.FabricWaystones;
import wraith.fwaystones.access.StructurePoolBasedGenerator_StructurePoolGeneratorAccess;
import wraith.fwaystones.util.Config;
import wraith.fwaystones.util.WaystonesWorldgen;
Expand All @@ -49,7 +50,7 @@ private static boolean isWaystone(StructurePoolElement element) {
.left()
.orElse(new Identifier("empty"))
.getNamespace()
.equals("waystones");
.equals(FabricWaystones.MOD_ID);
}

@Unique
Expand Down Expand Up @@ -112,7 +113,7 @@ private void fabricwaystones_limitWaystonePieceSpawning(PoolStructurePiece piece
.left()
.orElse(new Identifier("empty"))
.getNamespace()
.equals("waystones")
.equals(FabricWaystones.MOD_ID)
)
.count();
final boolean hasMaxWaystones = villageWaystoneCount >= maxWaystoneCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.fabricmc.api.Environment;
import net.minecraft.client.item.ModelPredicateProviderRegistry;
import net.minecraft.nbt.NbtCompound;
import wraith.fwaystones.FabricWaystones;
import wraith.fwaystones.item.LocalVoidItem;
import wraith.fwaystones.item.WaystoneScrollItem;
import wraith.fwaystones.util.Utils;
Expand All @@ -19,10 +20,10 @@ public static void register() {
}
if (stack.getItem() instanceof WaystoneScrollItem) {
NbtCompound tag = stack.getNbt();
return tag == null || !tag.contains("waystones") || tag.getList("waystones", 8).isEmpty() ? 0 : 1;
return tag == null || !tag.contains(FabricWaystones.MOD_ID) || tag.getList(FabricWaystones.MOD_ID, 8).isEmpty() ? 0 : 1;
} else if (stack.getItem() instanceof LocalVoidItem) {
NbtCompound tag = stack.getNbt();
return tag == null || !tag.contains("waystone") ? 0 : 1;
return tag == null || !tag.contains(FabricWaystones.MOD_ID) ? 0 : 1;
}
return 0f;
}
Expand Down
168 changes: 0 additions & 168 deletions src/main/java/wraith/fwaystones/util/CompatibilityLayer.java

This file was deleted.

7 changes: 0 additions & 7 deletions src/main/java/wraith/fwaystones/util/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
// TODO: rewrite/migrate to new config system
public final class Config {

private static final String OLD_CONFIG_FILE = "config/waystones/config.json";
private static final String CONFIG_FILE = "config/fwaystones/config.json";
private static Config instance = null;
public NbtCompound configData;
Expand Down Expand Up @@ -436,12 +435,6 @@ private NbtCompound toNbtCompound(JsonObject json) {
@SuppressWarnings("UnusedReturnValue")
public boolean loadConfig() {
try {
// TODO: Remove compat stuff
var file = new File(OLD_CONFIG_FILE);
if (file.exists()) {
file.renameTo(new File(CONFIG_FILE));
}
// end compat stuff
return loadConfig(getJsonObject(readFile(new File(CONFIG_FILE))));
} catch (Exception e) {
LOGGER.info("Found error with config. Using default config.");
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/wraith/fwaystones/util/CustomItemGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import wraith.fwaystones.FabricWaystones;
import wraith.fwaystones.registry.BlockRegistry;

public class CustomItemGroup {

public static final ItemGroup WAYSTONE_GROUP = FabricItemGroupBuilder.create(Utils.ID("fwaystones")).icon(() -> new ItemStack(BlockRegistry.WAYSTONE)).build();
public static final ItemGroup WAYSTONE_GROUP = FabricItemGroupBuilder.create(Utils.ID(FabricWaystones.MOD_ID)).icon(() -> new ItemStack(BlockRegistry.WAYSTONE)).build();

}
Loading

0 comments on commit 605b2db

Please sign in to comment.