-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da0057c
commit 540b68c
Showing
49 changed files
with
458 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
This version adds Fishing unpatch (you can use your afk fishing farms without any trouble), adds some advancements and fixes some bugs. | ||
And now the jar is 30% smaller, and Fabric loads faster. | ||
This version (0.2.0) adds configuration (you can disable everything that you don't want) and support for 1.16.2 | ||
Still works on 1.16.1, Forge & Fabric (tested). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package com.vanilla.experience; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.GsonBuilder; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import java.io.File; | ||
import java.io.FileReader; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
|
||
public class Config { | ||
private File configFilePath; | ||
|
||
private static final Logger LOGGER = LogManager.getLogger(); | ||
|
||
public Config(File configFilePath) { | ||
this.configFilePath = configFilePath; | ||
} | ||
|
||
public static class ConfigBean { | ||
public boolean isDataPackEnabled = true; | ||
public boolean isEnhancedBerriesEnabled = true; | ||
public boolean isEnhancedBoneMealEnabled = true; | ||
public boolean isEnhancedBurningEnabled = true; | ||
public boolean isEnhancedIceEnabled = true; | ||
public boolean isEnhancedKelpEnabled = true; | ||
public boolean isEnhancedSeedsEnabled = true; | ||
public boolean isEnhancedTotemEnabled = true; | ||
public boolean isFishingUnpatchEnabled = true; | ||
public boolean isProtectionUnpatchEnabled = true; | ||
public boolean isSlimeSuperFlatPatchEnabled = true; | ||
public boolean isWitherRosesUnpatchEnabled = true; | ||
public boolean isZeroTickUnpatchEnabled = true; | ||
|
||
public int currentFileVersionPleaseNeverChangeThisModInternalUsageOnly = 1; | ||
} | ||
|
||
private ConfigBean currentConfig = null; | ||
|
||
public ConfigBean get() { | ||
if(currentConfig != null) return currentConfig; | ||
|
||
if(configFilePath.exists()) currentConfig = this.load(); | ||
|
||
if(currentConfig != null) return currentConfig; | ||
|
||
currentConfig = new ConfigBean(); | ||
|
||
this.writeConfigFile(currentConfig); | ||
return currentConfig; | ||
} | ||
|
||
private ConfigBean load() { | ||
ConfigBean currentConfig = this.readConfigFile(configFilePath); | ||
if (currentConfig != null) { | ||
if(currentConfig.currentFileVersionPleaseNeverChangeThisModInternalUsageOnly == 1) return currentConfig; | ||
// UPGRADE CONFIG ROUTINES | ||
} | ||
return null; | ||
} | ||
|
||
public ConfigBean readConfigFile(File path) { | ||
try (FileReader file = new FileReader(path)) { | ||
Gson gson = new Gson(); | ||
return gson.fromJson(file, ConfigBean.class); | ||
} | ||
catch (IOException e) { | ||
LOGGER.error("Failed to read from config."); | ||
return null; | ||
} | ||
} | ||
|
||
public void writeConfigFile(ConfigBean config) { | ||
if (!configFilePath.getParentFile().exists() && !configFilePath.getParentFile().mkdirs()) { | ||
LOGGER.error("Failed to write the config."); | ||
return; | ||
} | ||
try (FileWriter file = new FileWriter(configFilePath)) { | ||
Gson gson = new GsonBuilder().setPrettyPrinting().create(); | ||
file.write(gson.toJson(config)); | ||
file.flush(); | ||
} | ||
catch (IOException e) { | ||
LOGGER.error("Failed to write the config."); | ||
} | ||
} | ||
} |
26 changes: 0 additions & 26 deletions
26
.../src/main/resources/data/vanillaexperience/advancements/minecraft/story/mine_diamond.json
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
common/src/main/resources/data/vanillaexperience/loot_tables/inject/gameplay/fishing.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
fabric/src/main/java/com/vanilla/experience/fabric/datapack/DataPackDisabler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.vanilla.experience.fabric.datapack; | ||
|
||
import com.vanilla.experience.fabric.utils.VexUtils; | ||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; | ||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents.ServerStarted; | ||
import net.minecraft.server.MinecraftServer; | ||
|
||
public class DataPackDisabler implements ServerStarted { | ||
|
||
public DataPackDisabler() { | ||
ServerLifecycleEvents.SERVER_STARTED.register(this); | ||
} | ||
|
||
@Override | ||
public void onServerStarted(MinecraftServer server) { | ||
server.getCommandManager().execute(server.getCommandSource().withLevel(2), "datapack disable \"fabric/" + VexUtils.getModId() + "\""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
fabric/src/main/java/com/vanilla/experience/fabric/enhancedburning/FlintAndSteelAttack.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
fabric/src/main/java/com/vanilla/experience/fabric/enhancedburning/mixin/FirePatchMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.vanilla.experience.fabric.enhancedburning.mixin; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.damage.DamageSource; | ||
import net.minecraft.entity.effect.StatusEffect; | ||
import net.minecraft.entity.effect.StatusEffects; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(LivingEntity.class) | ||
public abstract class FirePatchMixin extends Entity { | ||
|
||
public FirePatchMixin(EntityType<?> type, World world) { | ||
super(type, world); | ||
} | ||
|
||
@Shadow public abstract boolean hasStatusEffect(StatusEffect effect); | ||
|
||
@Inject(method = "onDeath", at = @At("HEAD")) | ||
private void onDeath(DamageSource source, CallbackInfo info) { | ||
if(source.isFire()) { | ||
if(!this.isOnFire()) { | ||
this.setOnFireFor(1); | ||
} | ||
} | ||
} | ||
|
||
@Inject(method = "baseTick", at = @At("HEAD")) | ||
private void baseTick(CallbackInfo info) { | ||
if(this.hasStatusEffect(StatusEffects.FIRE_RESISTANCE)) { | ||
this.extinguish(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.