Added TOML config
parent
1886b964d0
commit
f03c95d213
|
@ -16,6 +16,7 @@ repositories {
|
||||||
// Loom adds some essential maven repositories to download Minecraft and libraries from automatically.
|
// Loom adds some essential maven repositories to download Minecraft and libraries from automatically.
|
||||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||||
// for more information about repositories.
|
// for more information about repositories.
|
||||||
|
mavenCentral()
|
||||||
maven {
|
maven {
|
||||||
name 'Jitpack'
|
name 'Jitpack'
|
||||||
url 'https://jitpack.io/'
|
url 'https://jitpack.io/'
|
||||||
|
@ -43,6 +44,8 @@ dependencies {
|
||||||
transitive false
|
transitive false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compile 'com.electronwill.night-config:toml:3.6.6'
|
||||||
|
|
||||||
// API. You technically don't need it, but it's extremely useful for not having to write the same code in every mod.
|
// API. You technically don't need it, but it's extremely useful for not having to write the same code in every mod.
|
||||||
// modImplementation "io.github.minecraft-cursed-legacy:cursed-legacy-api:${project.api_version}"
|
// modImplementation "io.github.minecraft-cursed-legacy:cursed-legacy-api:${project.api_version}"
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,7 @@ import net.fabricmc.api.ModInitializer;
|
||||||
|
|
||||||
public class MainMod implements ModInitializer {
|
public class MainMod implements ModInitializer {
|
||||||
|
|
||||||
// private static WritableConfig config;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
// // example config
|
|
||||||
// try {
|
|
||||||
// config = Configs.loadOrCreate(new Id("modid", "example"),
|
|
||||||
// ConfigTemplate.builder()
|
|
||||||
// .addContainer("exampleContainer", container -> container.addDataEntry("someData", "0.5"))
|
|
||||||
// .build());
|
|
||||||
// } catch (IOException e) {
|
|
||||||
// throw new RuntimeException(e);
|
|
||||||
// }
|
|
||||||
// System.out.println(config.getDoubleValue("exampleContainer.someData"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
package xyz.pixelatedw.betterbeta;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||||
|
import com.electronwill.nightconfig.core.file.CommentedFileConfigBuilder;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
|
public class ModConfig {
|
||||||
|
|
||||||
|
private static final String CONFIG_PATH = "config/betterbeta.toml";
|
||||||
|
private static final List<Option> OPTIONS = new ArrayList<>();
|
||||||
|
|
||||||
|
private CommentedFileConfig fileConfig;
|
||||||
|
|
||||||
|
public static final Option<Boolean> SUGAR_CANE_ON_SAND = make("Sugar Cane on sand", true, "Allows sugar canes to be placed on sand");
|
||||||
|
public static final Option<Boolean> ADD_MORE_SOUNDS = make("Add more sounds", true,
|
||||||
|
"Links a few more sounds from your local 'resources' folder with the game, namely for item breaking, minecarts and chests");
|
||||||
|
public static final Option<Boolean> FIX_BOW_MODEL = make("Fix bow model", true,
|
||||||
|
"Makes the box model held by players and skeletons bigger and facing forward");
|
||||||
|
public static final Option<Boolean> FIX_MINECART_FLICKERING = make("Fix minecart flickering", true,
|
||||||
|
"Fixes minecarts flickering when looking at their backs as a passanger");
|
||||||
|
public static final Option<Boolean> FIX_MINECART_STOPPING_ON_ITEMS = make("Fix minecart stopping on items", true,
|
||||||
|
"Fixes minecarts getting stopped by arrows and dropped items on tracks");
|
||||||
|
public static final Option<Boolean> FIX_FISHING = make("Fix fishing", true, "Fixes fishes going above the player's head when fishing");
|
||||||
|
public static final Option<Boolean> FIX_LEG_ARMOR_ON_VEHICLES = make("Fix leg armor on vehicles", true,
|
||||||
|
"Fixes leg armor not properly getting updated when switching poses (start/stop riding a vehicle)");
|
||||||
|
public static final Option<Boolean> FIX_STAIRS_DROPS = make("Fix stairs drops", true, "Fix stairs not dropping themselves when mined");
|
||||||
|
public static final Option<Boolean> FIX_PICKAXE_EFFECTIVENESS = make("Fix pickaxe effectiveness", true,
|
||||||
|
"Fixes pickaxes not being effective agaist certain blocks that it should be effective on");
|
||||||
|
public static final Option<Boolean> FIX_AXE_EFFECTIVENESS = make("Fix axe effectiveness", true,
|
||||||
|
"Fixes axes not being effective agaist certain blocks that it should be effective on");
|
||||||
|
|
||||||
|
private static ModConfig instance = new ModConfig();
|
||||||
|
public static final ModConfig instance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModConfig() {
|
||||||
|
CommentedFileConfigBuilder builder = CommentedFileConfig.builder(CONFIG_PATH);
|
||||||
|
this.fileConfig = builder.autosave().autoreload().build();
|
||||||
|
|
||||||
|
this.fileConfig.load();
|
||||||
|
|
||||||
|
boolean save = false;
|
||||||
|
for (Option o : OPTIONS) {
|
||||||
|
if (!this.fileConfig.contains(o.name)) {
|
||||||
|
this.fileConfig.add(o.name, o.defaultValue);
|
||||||
|
this.fileConfig.setComment(o.name, o.description);
|
||||||
|
save = true;
|
||||||
|
} else if (!Strings.isNullOrEmpty(o.description) && this.fileConfig.contains(o.name)
|
||||||
|
&& !this.fileConfig.containsComment(o.name)) {
|
||||||
|
this.fileConfig.setComment(o.name, o.description);
|
||||||
|
save = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (save) {
|
||||||
|
this.fileConfig.load();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Option<T> make(String name, T defaultValue, String description) {
|
||||||
|
Option<T> option = new Option(name, defaultValue, description);
|
||||||
|
OPTIONS.add(option);
|
||||||
|
return option;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T get(Option<T> o) {
|
||||||
|
return this.fileConfig.getOrElse(o.name, o.defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Option<T> {
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private T defaultValue;
|
||||||
|
|
||||||
|
public Option(String name, T defaultValue, String description) {
|
||||||
|
this.name = name;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Option(String name, T defaultValue) {
|
||||||
|
this.name = name;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T get() {
|
||||||
|
return ModConfig.instance().get(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -40,6 +40,9 @@ public class WyHelper {
|
||||||
// enemy.setPositionAndAngles(player.x + 2, player.y, player.z, 0.0f, 0.0f);
|
// enemy.setPositionAndAngles(player.x + 2, player.y, player.z, 0.0f, 0.0f);
|
||||||
// player.level.spawnEntity(enemy);
|
// player.level.spawnEntity(enemy);
|
||||||
|
|
||||||
|
boolean b = ModConfig.instance().get(ModConfig.SUGAR_CANE_ON_SAND);
|
||||||
|
System.out.println(b);
|
||||||
|
|
||||||
player.level.setLevelTime(0);
|
player.level.setLevelTime(0);
|
||||||
player.level.getProperties().setRaining(false);
|
player.level.getProperties().setRaining(false);
|
||||||
player.level.getProperties().setRainTime(0);
|
player.level.getProperties().setRainTime(0);
|
||||||
|
|
|
@ -11,16 +11,19 @@ import net.minecraft.client.render.entity.BipedEntityRenderer;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.item.ItemInstance;
|
import net.minecraft.item.ItemInstance;
|
||||||
import net.minecraft.item.ItemType;
|
import net.minecraft.item.ItemType;
|
||||||
|
import xyz.pixelatedw.betterbeta.ModConfig;
|
||||||
|
|
||||||
@Mixin(BipedEntityRenderer.class)
|
@Mixin(BipedEntityRenderer.class)
|
||||||
public class BipedRendererMixin {
|
public class BipedRendererMixin {
|
||||||
|
|
||||||
@Inject(method = "method_827", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/HandItemRenderer;method_1862(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemInstance;)V", shift = Shift.BEFORE))
|
@Inject(method = "method_827", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/HandItemRenderer;method_1862(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemInstance;)V", shift = Shift.BEFORE))
|
||||||
public void playerRendering(LivingEntity entity, float f, CallbackInfo ci) {
|
public void playerRendering(LivingEntity entity, float f, CallbackInfo ci) {
|
||||||
ItemInstance item = entity.getHandRenderItem();
|
if(ModConfig.FIX_BOW_MODEL.get()) {
|
||||||
if (item != null && item.itemId == ItemType.bow.id) {
|
ItemInstance item = entity.getHandRenderItem();
|
||||||
GL11.glRotatef(-5, 1, 0, 0);
|
if (item != null && item.itemId == ItemType.bow.id) {
|
||||||
GL11.glTranslatef(0.2F, -0.5F, 0.2F);
|
GL11.glRotatef(-5, 1, 0, 0);
|
||||||
|
GL11.glTranslatef(0.2F, -0.5F, 0.2F);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import net.minecraft.item.ItemType;
|
import net.minecraft.item.ItemType;
|
||||||
import net.minecraft.item.tool.BowItem;
|
import net.minecraft.item.tool.BowItem;
|
||||||
|
import xyz.pixelatedw.betterbeta.ModConfig;
|
||||||
|
|
||||||
@Mixin(BowItem.class)
|
@Mixin(BowItem.class)
|
||||||
public class BowItemMixin {
|
public class BowItemMixin {
|
||||||
@Inject(method = "<init>(I)V", at = @At("TAIL"))
|
@Inject(method = "<init>(I)V", at = @At("TAIL"))
|
||||||
public void init(int i, CallbackInfo ci) {
|
public void init(int i, CallbackInfo ci) {
|
||||||
ItemType item = ((ItemType) (Object) this);
|
if(ModConfig.FIX_BOW_MODEL.get()) {
|
||||||
item.method_466();
|
ItemType item = ((ItemType) (Object) this);
|
||||||
|
item.method_466();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.container.ChestContainer;
|
||||||
import net.minecraft.entity.player.ClientPlayer;
|
import net.minecraft.entity.player.ClientPlayer;
|
||||||
import net.minecraft.entity.player.Player;
|
import net.minecraft.entity.player.Player;
|
||||||
import net.minecraft.inventory.Inventory;
|
import net.minecraft.inventory.Inventory;
|
||||||
|
import xyz.pixelatedw.betterbeta.ModConfig;
|
||||||
import xyz.pixelatedw.betterbeta.WyHelper;
|
import xyz.pixelatedw.betterbeta.WyHelper;
|
||||||
|
|
||||||
@Mixin(ClientPlayer.class)
|
@Mixin(ClientPlayer.class)
|
||||||
|
@ -28,15 +29,19 @@ public class ClientPlayerMixin {
|
||||||
|
|
||||||
@Inject(method = "openChestScreen", at = @At("TAIL"))
|
@Inject(method = "openChestScreen", at = @At("TAIL"))
|
||||||
public void openChestScreen(Inventory arg, CallbackInfo ci) {
|
public void openChestScreen(Inventory arg, CallbackInfo ci) {
|
||||||
Player player = (Player) (Object) this;
|
if(ModConfig.ADD_MORE_SOUNDS.get()) {
|
||||||
player.level.playSound(player, "random.chestopen", 0.3f, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
|
Player player = (Player) (Object) this;
|
||||||
|
player.level.playSound(player, "random.chestopen", 0.3f, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "closeContainer", at = @At("HEAD"))
|
@Inject(method = "closeContainer", at = @At("HEAD"))
|
||||||
public void closeContainer(CallbackInfo ci) {
|
public void closeContainer(CallbackInfo ci) {
|
||||||
Player player = (Player) (Object) this;
|
if(ModConfig.ADD_MORE_SOUNDS.get()) {
|
||||||
if(player.container instanceof ChestContainer) {
|
Player player = (Player) (Object) this;
|
||||||
player.level.playSound(player, "random.chestclosed", 0.3f, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
|
if(player.container instanceof ChestContainer) {
|
||||||
|
player.level.playSound(player, "random.chestclosed", 0.3f, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,19 +7,22 @@ import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
|
||||||
|
|
||||||
import net.minecraft.entity.FishHook;
|
import net.minecraft.entity.FishHook;
|
||||||
import net.minecraft.entity.ItemEntity;
|
import net.minecraft.entity.ItemEntity;
|
||||||
|
import xyz.pixelatedw.betterbeta.ModConfig;
|
||||||
|
|
||||||
@Mixin(FishHook.class)
|
@Mixin(FishHook.class)
|
||||||
public class FishHookMixin {
|
public class FishHookMixin {
|
||||||
|
|
||||||
@ModifyArgs(method = "method_956", at = @At(value = "INVOKE", target = "Lnet/minecraft/level/Level;spawnEntity(Lnet/minecraft/entity/Entity;)Z"))
|
@ModifyArgs(method = "method_956", at = @At(value = "INVOKE", target = "Lnet/minecraft/level/Level;spawnEntity(Lnet/minecraft/entity/Entity;)Z"))
|
||||||
private void onFishCaught(Args args) {
|
private void onFishCaught(Args args) {
|
||||||
ItemEntity item = args.get(0);
|
if(ModConfig.FIX_FISHING.get()) {
|
||||||
FishHook hook = (FishHook) (Object) this;
|
ItemEntity item = args.get(0);
|
||||||
double x = hook.field_1067.x - hook.x;
|
FishHook hook = (FishHook) (Object) this;
|
||||||
double y = hook.field_1067.y - hook.y;
|
double x = hook.field_1067.x - hook.x;
|
||||||
double z = hook.field_1067.z - hook.z;
|
double y = hook.field_1067.y - hook.y;
|
||||||
item.velocityX = x * 0.1D;
|
double z = hook.field_1067.z - hook.z;
|
||||||
item.velocityY = y * 0.1D + Math.sqrt(Math.sqrt(x * x + y * y + z * z)) * 0.05D;
|
item.velocityX = x * 0.1D;
|
||||||
item.velocityZ = z * 0.1D;
|
item.velocityY = y * 0.1D + Math.sqrt(Math.sqrt(x * x + y * y + z * z)) * 0.05D;
|
||||||
|
item.velocityZ = z * 0.1D;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.item.ItemInstance;
|
import net.minecraft.item.ItemInstance;
|
||||||
|
import xyz.pixelatedw.betterbeta.ModConfig;
|
||||||
|
|
||||||
@Mixin(ItemInstance.class)
|
@Mixin(ItemInstance.class)
|
||||||
public class ItemInstanceMixin {
|
public class ItemInstanceMixin {
|
||||||
|
@ -21,9 +22,11 @@ public class ItemInstanceMixin {
|
||||||
|
|
||||||
@Inject(method = "applyDamage", at = @At("HEAD"))
|
@Inject(method = "applyDamage", at = @At("HEAD"))
|
||||||
public void applyDamage(int i, Entity arg, CallbackInfo ci) {
|
public void applyDamage(int i, Entity arg, CallbackInfo ci) {
|
||||||
ItemInstance item = (ItemInstance) (Object) this;
|
if(ModConfig.ADD_MORE_SOUNDS.get()) {
|
||||||
if (this.damage + i > item.method_723()) {
|
ItemInstance item = (ItemInstance) (Object) this;
|
||||||
arg.level.playSound(arg, "random.break", 0.5f, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
|
if (this.damage + i > item.method_723()) {
|
||||||
|
arg.level.playSound(arg, "random.break", 0.5f, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.entity.projectile.Arrow;
|
||||||
import net.minecraft.tile.RailTile;
|
import net.minecraft.tile.RailTile;
|
||||||
import net.minecraft.util.maths.Box;
|
import net.minecraft.util.maths.Box;
|
||||||
import net.minecraft.util.maths.MathsHelper;
|
import net.minecraft.util.maths.MathsHelper;
|
||||||
|
import xyz.pixelatedw.betterbeta.ModConfig;
|
||||||
import xyz.pixelatedw.betterbeta.WyHelper;
|
import xyz.pixelatedw.betterbeta.WyHelper;
|
||||||
|
|
||||||
@Mixin(Minecart.class)
|
@Mixin(Minecart.class)
|
||||||
|
@ -23,8 +24,10 @@ public class MinecartMixin {
|
||||||
|
|
||||||
@Inject(method = "method_1379", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "method_1379", at = @At("HEAD"), cancellable = true)
|
||||||
public void onCollision(Entity other, CallbackInfoReturnable<Box> ci) {
|
public void onCollision(Entity other, CallbackInfoReturnable<Box> ci) {
|
||||||
if(other instanceof ItemEntity || other instanceof Arrow) {
|
if (ModConfig.FIX_MINECART_STOPPING_ON_ITEMS.get()) {
|
||||||
ci.setReturnValue(null);
|
if (other instanceof ItemEntity || other instanceof Arrow) {
|
||||||
|
ci.setReturnValue(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +43,10 @@ public class MinecartMixin {
|
||||||
float volume = 0;
|
float volume = 0;
|
||||||
float pitch = 0;
|
float pitch = 0;
|
||||||
if (speed >= 0.01D) {
|
if (speed >= 0.01D) {
|
||||||
if(minecart.passenger != null) {
|
if (minecart.passenger != null && ModConfig.FIX_MINECART_FLICKERING.get()) {
|
||||||
minecart.boundingBox.set(minecart.boundingBox.minX - EXTRA_MINECART_XZ_SIZE, minecart.boundingBox.minY, minecart.boundingBox.minZ - EXTRA_MINECART_XZ_SIZE, minecart.boundingBox.maxX + EXTRA_MINECART_XZ_SIZE, minecart.boundingBox.maxY + EXTRA_MINECART_Y_SIZE, minecart.boundingBox.maxZ + EXTRA_MINECART_XZ_SIZE);
|
minecart.boundingBox.set(minecart.boundingBox.minX - EXTRA_MINECART_XZ_SIZE, minecart.boundingBox.minY,
|
||||||
|
minecart.boundingBox.minZ - EXTRA_MINECART_XZ_SIZE, minecart.boundingBox.maxX + EXTRA_MINECART_XZ_SIZE,
|
||||||
|
minecart.boundingBox.maxY + EXTRA_MINECART_Y_SIZE, minecart.boundingBox.maxZ + EXTRA_MINECART_XZ_SIZE);
|
||||||
}
|
}
|
||||||
++minecart.field_1645;
|
++minecart.field_1645;
|
||||||
pitch = WyHelper.clamp(pitch + 0.0025F, 0.0F, 1.0F);
|
pitch = WyHelper.clamp(pitch + 0.0025F, 0.0F, 1.0F);
|
||||||
|
@ -51,7 +56,7 @@ public class MinecartMixin {
|
||||||
pitch = 0.0f;
|
pitch = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (speed >= 0.01D) {
|
if (speed >= 0.01D && ModConfig.ADD_MORE_SOUNDS.get()) {
|
||||||
if (minecart.field_1645 % 34 == 1) {
|
if (minecart.field_1645 % 34 == 1) {
|
||||||
minecart.level.playSound(x, y, z, "minecart.base", volume, pitch);
|
minecart.level.playSound(x, y, z, "minecart.base", volume, pitch);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,19 +8,22 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import xyz.pixelatedw.betterbeta.ModConfig;
|
||||||
|
|
||||||
@Mixin(Minecraft.class)
|
@Mixin(Minecraft.class)
|
||||||
public class MinecraftMixin {
|
public class MinecraftMixin {
|
||||||
@Inject(method = "loadSoundFromDir", at = @At("HEAD"))
|
@Inject(method = "loadSoundFromDir", at = @At("HEAD"))
|
||||||
public void loadSoundFromDir(String string, File file, CallbackInfo ci) {
|
public void loadSoundFromDir(String string, File file, CallbackInfo ci) {
|
||||||
Minecraft mc = (Minecraft) (Object) this;
|
if(ModConfig.ADD_MORE_SOUNDS.get()) {
|
||||||
int split = string.indexOf("/");
|
Minecraft mc = (Minecraft) (Object) this;
|
||||||
String type = string.substring(0, split);
|
int split = string.indexOf("/");
|
||||||
String newSound = string.substring(split + 1);
|
String type = string.substring(0, split);
|
||||||
// For now only allow the minecart sounds, allowing all of them causes weird effects with same name sounds when the game decides which one to use
|
String newSound = string.substring(split + 1);
|
||||||
// XXX Could always incorporate the sound3 part into the sound's name and have it accessible as sound3.random.bow for example, which would avoid the overlap with current sounds
|
// For now only allow the minecart sounds, allowing all of them causes weird effects with same name sounds when the game decides which one to use
|
||||||
if (type.equalsIgnoreCase("sound3") && newSound.startsWith("minecart/")) {
|
// XXX Could always incorporate the sound3 part into the sound's name and have it accessible as sound3.random.bow for example, which would avoid the overlap with current sounds
|
||||||
mc.soundHelper.method_2011(newSound, file);
|
if (type.equalsIgnoreCase("sound3") && newSound.startsWith("minecart/")) {
|
||||||
|
mc.soundHelper.method_2011(newSound, file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,10 @@ import net.minecraft.entity.player.Player;
|
||||||
import net.minecraft.item.ItemInstance;
|
import net.minecraft.item.ItemInstance;
|
||||||
import net.minecraft.item.ItemType;
|
import net.minecraft.item.ItemType;
|
||||||
import net.minecraft.item.armour.ArmourItem;
|
import net.minecraft.item.armour.ArmourItem;
|
||||||
|
import xyz.pixelatedw.betterbeta.ModConfig;
|
||||||
|
|
||||||
@Mixin(PlayerRenderer.class)
|
@Mixin(PlayerRenderer.class)
|
||||||
public class PlayerRendererMixin extends LivingEntityRendererMixin{
|
public class PlayerRendererMixin extends LivingEntityRendererMixin {
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
private BipedModel field_295; // Armor
|
private BipedModel field_295; // Armor
|
||||||
|
@ -26,19 +27,23 @@ public class PlayerRendererMixin extends LivingEntityRendererMixin{
|
||||||
|
|
||||||
@Inject(method = "method_827", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/HandItemRenderer;method_1862(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemInstance;)V", shift = Shift.BEFORE))
|
@Inject(method = "method_827", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/HandItemRenderer;method_1862(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemInstance;)V", shift = Shift.BEFORE))
|
||||||
public void playerRendering(Player player, float f, CallbackInfo ci) {
|
public void playerRendering(Player player, float f, CallbackInfo ci) {
|
||||||
ItemInstance item = player.inventory.getHeldItem();
|
if (ModConfig.FIX_BOW_MODEL.get()) {
|
||||||
if (item != null && item.itemId == ItemType.bow.id) {
|
ItemInstance item = player.inventory.getHeldItem();
|
||||||
GL11.glTranslatef(0.0F, -0.5F, 0.0F);
|
if (item != null && item.itemId == ItemType.bow.id) {
|
||||||
|
GL11.glTranslatef(0.0F, -0.5F, 0.0F);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "render(Lnet/minecraft/entity/player/Player;DDDFF)V", at = @At("HEAD"))
|
@Inject(method = "render(Lnet/minecraft/entity/player/Player;DDDFF)V", at = @At("HEAD"))
|
||||||
public void render(Player arg, double d, double d1, double d2, float f, float f1, CallbackInfo ci) {
|
public void render(Player arg, double d, double d1, double d2, float f, float f1, CallbackInfo ci) {
|
||||||
ItemInstance stack = arg.inventory.getArmourItem(1);
|
if (ModConfig.FIX_LEG_ARMOR_ON_VEHICLES.get()) {
|
||||||
if (stack != null) {
|
ItemInstance stack = arg.inventory.getArmourItem(1);
|
||||||
ItemType item = stack.getType();
|
if (stack != null) {
|
||||||
if (item instanceof ArmourItem) {
|
ItemType item = stack.getType();
|
||||||
this.field_296.isRiding = this.field_909.isRiding;
|
if (item instanceof ArmourItem) {
|
||||||
|
this.field_296.isRiding = this.field_909.isRiding;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,4 @@ public class ScreenMixin {
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
public Minecraft minecraft;
|
public Minecraft minecraft;
|
||||||
|
|
||||||
// @Inject(method = "init(Lnet/minecraft/client/Minecraft;II)V", at = @At("HEAD"))
|
|
||||||
// public void init(Minecraft minecraft, int i, int j, CallbackInfo ci) {
|
|
||||||
// this.instance = minecraft;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,18 +8,21 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import net.minecraft.client.render.entity.model.BipedModel;
|
import net.minecraft.client.render.entity.model.BipedModel;
|
||||||
import net.minecraft.client.render.entity.model.SkeletonModel;
|
import net.minecraft.client.render.entity.model.SkeletonModel;
|
||||||
import net.minecraft.client.render.entity.model.ZombieModel;
|
import net.minecraft.client.render.entity.model.ZombieModel;
|
||||||
|
import xyz.pixelatedw.betterbeta.ModConfig;
|
||||||
|
|
||||||
@Mixin(ZombieModel.class)
|
@Mixin(ZombieModel.class)
|
||||||
public class SkeletonModelMixin {
|
public class SkeletonModelMixin {
|
||||||
@Inject(method = "setAngles", at = @At("TAIL"))
|
@Inject(method = "setAngles", at = @At("TAIL"))
|
||||||
public void setAngles(float f, float f1, float f2, float f3, float f4, float f5, CallbackInfo ci) {
|
public void setAngles(float f, float f1, float f2, float f3, float f4, float f5, CallbackInfo ci) {
|
||||||
BipedModel model = ((BipedModel) (Object) this);
|
if(ModConfig.FIX_BOW_MODEL.get()) {
|
||||||
if(model instanceof SkeletonModel) {
|
BipedModel model = ((BipedModel) (Object) this);
|
||||||
model.leftArm.yaw = 0.45f;
|
if(model instanceof SkeletonModel) {
|
||||||
model.rightArm.yaw = -0.2f;
|
model.leftArm.yaw = 0.45f;
|
||||||
model.leftArm.pitch -= 0.05f;
|
model.rightArm.yaw = -0.2f;
|
||||||
model.rightArm.pitch -= 0.05f;
|
model.leftArm.pitch -= 0.05f;
|
||||||
model.rightArm.roll += 0.1f;
|
model.rightArm.pitch -= 0.05f;
|
||||||
|
model.rightArm.roll += 0.1f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,23 +10,26 @@ import net.minecraft.item.ItemInstance;
|
||||||
import net.minecraft.level.Level;
|
import net.minecraft.level.Level;
|
||||||
import net.minecraft.tile.StairsTile;
|
import net.minecraft.tile.StairsTile;
|
||||||
import net.minecraft.tile.Tile;
|
import net.minecraft.tile.Tile;
|
||||||
|
import xyz.pixelatedw.betterbeta.ModConfig;
|
||||||
|
|
||||||
@Mixin(StairsTile.class)
|
@Mixin(StairsTile.class)
|
||||||
public class StairsTileMixin {
|
public class StairsTileMixin {
|
||||||
|
|
||||||
@Inject(method = "beforeDestroyedByExplosion", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "beforeDestroyedByExplosion", at = @At("HEAD"), cancellable = true)
|
||||||
public void beforeDestroyedByExplosion(Level arg, int i, int j, int k, int i1, float f, CallbackInfo ci) {
|
public void beforeDestroyedByExplosion(Level arg, int i, int j, int k, int i1, float f, CallbackInfo ci) {
|
||||||
Tile tile = ((Tile) (Object) this);
|
if(ModConfig.FIX_STAIRS_DROPS.get()) {
|
||||||
ItemInstance item = new ItemInstance(tile.id, 1, 0);
|
Tile tile = ((Tile) (Object) this);
|
||||||
if (!arg.isClient) {
|
ItemInstance item = new ItemInstance(tile.id, 1, 0);
|
||||||
float var6 = 0.7F;
|
if (!arg.isClient) {
|
||||||
double var7 = arg.rand.nextFloat() * var6 + (1.0F - var6) * 0.5D;
|
float var6 = 0.7F;
|
||||||
double var9 = arg.rand.nextFloat() * var6 + (1.0F - var6) * 0.5D;
|
double var7 = arg.rand.nextFloat() * var6 + (1.0F - var6) * 0.5D;
|
||||||
double var11 = arg.rand.nextFloat() * var6 + (1.0F - var6) * 0.5D;
|
double var9 = arg.rand.nextFloat() * var6 + (1.0F - var6) * 0.5D;
|
||||||
ItemEntity var13 = new ItemEntity(arg, i + var7, j + var9, k + var11, item);
|
double var11 = arg.rand.nextFloat() * var6 + (1.0F - var6) * 0.5D;
|
||||||
var13.pickupDelay = 10;
|
ItemEntity var13 = new ItemEntity(arg, i + var7, j + var9, k + var11, item);
|
||||||
arg.spawnEntity(var13);
|
var13.pickupDelay = 10;
|
||||||
|
arg.spawnEntity(var13);
|
||||||
|
}
|
||||||
|
ci.cancel();
|
||||||
}
|
}
|
||||||
ci.cancel();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,22 +9,25 @@ import net.minecraft.level.Level;
|
||||||
import net.minecraft.tile.SugarCane;
|
import net.minecraft.tile.SugarCane;
|
||||||
import net.minecraft.tile.Tile;
|
import net.minecraft.tile.Tile;
|
||||||
import net.minecraft.tile.material.Material;
|
import net.minecraft.tile.material.Material;
|
||||||
|
import xyz.pixelatedw.betterbeta.ModConfig;
|
||||||
|
|
||||||
@Mixin(SugarCane.class)
|
@Mixin(SugarCane.class)
|
||||||
public class SugarCaneMixin {
|
public class SugarCaneMixin {
|
||||||
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
|
||||||
public void canPlaceAt(Level arg, int x, int y, int z, CallbackInfoReturnable<Boolean> info) {
|
public void canPlaceAt(Level arg, int x, int y, int z, CallbackInfoReturnable<Boolean> info) {
|
||||||
int tileBelow = arg.getTileId(x, y - 1, z);
|
if(ModConfig.SUGAR_CANE_ON_SAND.get()) {
|
||||||
if (tileBelow == Tile.SAND.id) {
|
int tileBelow = arg.getTileId(x, y - 1, z);
|
||||||
boolean flag = false;
|
if (tileBelow == Tile.SAND.id) {
|
||||||
// Check if there is a water block around the sand block
|
boolean flag = false;
|
||||||
flag |= arg.getMaterial(x - 1, y - 1, z) == Material.WATER;
|
// Check if there is a water block around the sand block
|
||||||
flag |= arg.getMaterial(x + 1, y - 1, z) == Material.WATER;
|
flag |= arg.getMaterial(x - 1, y - 1, z) == Material.WATER;
|
||||||
flag |= arg.getMaterial(x, y - 1, z - 1) == Material.WATER;
|
flag |= arg.getMaterial(x + 1, y - 1, z) == Material.WATER;
|
||||||
flag |= arg.getMaterial(x, y - 1, z + 1) == Material.WATER;
|
flag |= arg.getMaterial(x, y - 1, z - 1) == Material.WATER;
|
||||||
|
flag |= arg.getMaterial(x, y - 1, z + 1) == Material.WATER;
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
info.setReturnValue(true);
|
info.setReturnValue(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.item.tool.PickaxeItem;
|
||||||
import net.minecraft.item.tool.ToolItem;
|
import net.minecraft.item.tool.ToolItem;
|
||||||
import net.minecraft.item.tool.ToolMaterial;
|
import net.minecraft.item.tool.ToolMaterial;
|
||||||
import net.minecraft.tile.Tile;
|
import net.minecraft.tile.Tile;
|
||||||
|
import xyz.pixelatedw.betterbeta.ModConfig;
|
||||||
|
|
||||||
@Mixin(ToolItem.class)
|
@Mixin(ToolItem.class)
|
||||||
public class ToolItemMixin {
|
public class ToolItemMixin {
|
||||||
|
@ -34,9 +35,9 @@ public class ToolItemMixin {
|
||||||
public void init(int i, int j, ToolMaterial arg, Tile[] args, CallbackInfo ci) {
|
public void init(int i, int j, ToolMaterial arg, Tile[] args, CallbackInfo ci) {
|
||||||
|
|
||||||
ToolItem tool = ((ToolItem) (Object) this);
|
ToolItem tool = ((ToolItem) (Object) this);
|
||||||
if (tool instanceof PickaxeItem) {
|
if (tool instanceof PickaxeItem && ModConfig.FIX_PICKAXE_EFFECTIVENESS.get()) {
|
||||||
this.field_2712 = PICKAXE_BLOCKS;
|
this.field_2712 = PICKAXE_BLOCKS;
|
||||||
} else if (tool instanceof HatchetItem) {
|
} else if (tool instanceof HatchetItem && ModConfig.FIX_AXE_EFFECTIVENESS.get()) {
|
||||||
this.field_2712 = HATCHET_BLOCKS;
|
this.field_2712 = HATCHET_BLOCKS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue