Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1 port mod from cursed legacy fabric #2

Merged
merged 15 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
795 changes: 674 additions & 121 deletions LICENSE

Large diffs are not rendered by default.

54 changes: 23 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A StationAPI mod for Minecraft Beta 1.7.3 that adds some quality of life changes

## List of tweaks from original mod

The following features were not ported since the fix already exists in AnnoyanceFix mod
The following features were removed either because I failed to port them correctly and so disabled them or because they might conflict with the same or similar fix in the AnnoyanceFix mod.

<details><summary>Updated list of blocks that pickaxes and axes can mine quicker</summary>

Expand Down Expand Up @@ -67,6 +67,26 @@ After:

</details>

<details><summary>Chest sounds</summary>

- Opening / closing chests

**Note: The mod doesn't add any sounds by itself, all of these sounds are already present in your "resources" folder, they are automatically downloaded by Minecraft itself**

</details>

<details><summary>Fixes torches (and redstone torches) not having a bottom texture</summary>

Before:
![torches without a bottom texture](https://i.imgur.com/pueAKg3.png)

After:
![torches with a bottom texture](https://i.imgur.com/pBmy6UX.png)

</details>

Fixing the grass block inventory item having the incorrect top texture

## List of changes

### Quality of Life changes
Expand All @@ -79,7 +99,6 @@ After:

<details><summary>More sounds</summary>

- Opening / closing chests
- Minecarts
- Items breaking

Expand Down Expand Up @@ -199,16 +218,6 @@ After:<br>

</details>

<details><summary>Fixes torches (and redstone torches) not having a bottom texture</summary>

Before:
![torches without a bottom texture](https://i.imgur.com/pueAKg3.png)

After:
![torches with a bottom texture](https://i.imgur.com/pBmy6UX.png)

</details>

<details><summary>Fixes furnaces consuming the buckets as well when using lava buckets</summary>

Before:<br>
Expand All @@ -219,25 +228,8 @@ After:

</details>
<br>
As well as a bunch of other minor issues not worth having before/after images such as grass block items being rendered incorrectly or the useless 10mb array wasting resources.

## Install (Under construction, install instruction not valid yet)

### Vanilla Launcher
- Download the Vanilla Launcher installer of Cursed Legacy Fabric from [https://minecraft-cursed-legacy.github.io/downloads.html](https://minecraft-cursed-legacy.github.io/downloads.html)
- Run the installer and let it finish
- Download the latest version of the mod
- Navigate your .minecraft > b1.7.3 > mods folder and drop the mod .jar file there
- Start the launcher and make sure you pick the Cursed Fabric profile before starting the game

### MultiMC / Prism Launcher
- Download the MultiMC archive of Cursed Legacy Fabric from [https://minecraft-cursed-legacy.github.io/downloads.html](https://minecraft-cursed-legacy.github.io/downloads.html)
- Open your MultiMC / Prism Launcher
- Drag the .zip file into the launcher (you can also choose a different name for this profile now) and click Ok
- Download the latest version of the mod
- Navigate to the newly created instance's location (easier way to do this is from your launcher right click on the profile and select Folder)
- Go in the .minecraft > mods folder and drop the mod .jar file there
- Go back to your launcher and start the Cursed Fabric profile you've just installed

As well as a few of other minor issues such as the useless 10mb array wasting resources.

## Installation using Prism Launcher

Expand Down
51 changes: 25 additions & 26 deletions src/main/java/com/github/telvarost/finalbeta/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,32 @@ public class Config {

public static class ConfigFields {

@ConfigName("Sugarcane Fixes Enabled")
@ConfigName("Allow sugarcane to be placed on sand")
public static Boolean sugarCaneFixesEnabled = true;

// 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> ENABLE_CLOUDS = make("Enable Clouds", true, "Enables the rendering of clouds");
// public static final Option<Boolean> DISABLE_ID_TAGS = make("Disable ID Tags", true,
// "Disables id tags showing above entities in F3 mode");
//
// 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");
// public static final Option<Boolean> FIX_SADDLES_NOT_DROPPING = make("Fix saddles not dropping", true,
// "Fixes saddles not dropping when killing saddled pigs");
// public static final Option<Boolean> FIX_FURNACE_LAVA_BUCKET = make("Fix furnace lava bucket", true,
// "Fixes furnaces consuming the bucket when using lava buckets as fuel");
@ConfigName("Fix bow models")
public static Boolean FIX_BOW_MODEL = true;

@ConfigName("Add more sounds")
public static Boolean ADD_MORE_SOUNDS = true;

@ConfigName("Fix fishing")
public static Boolean FIX_FISHING = true;

@ConfigName("Fix furnace lava bucket")
public static Boolean FIX_FURNACE_LAVA_BUCKET = true;

@ConfigName("Disable id tags")
public static Boolean DISABLE_ID_TAGS = true;

@ConfigName("Fix minecart stopping on items")
public static Boolean FIX_MINECART_STOPPING_ON_ITEMS = true;

@ConfigName("Fix minecart flickering")
public static Boolean FIX_MINECART_FLICKERING = true;

@ConfigName("Fix leg armor on vehicles")
public static Boolean FIX_LEG_ARMOR_ON_VEHICLES = true;

}
}
79 changes: 0 additions & 79 deletions src/main/java/com/github/telvarost/finalbeta/ModData.java

This file was deleted.

52 changes: 52 additions & 0 deletions src/main/java/com/github/telvarost/finalbeta/ModHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.github.telvarost.finalbeta;

import net.glasslauncher.mods.api.gcapi.api.ConfigName;
import net.minecraft.block.BlockBase;
import net.minecraft.entity.player.PlayerBase;
import net.minecraft.item.ItemBase;
import net.minecraft.item.ItemInstance;
import net.minecraft.stat.Stats;
import net.minecraft.client.Minecraft;

import java.lang.reflect.Field;
import java.time.Duration;
import java.util.Random;

public class ModHelper {

public static Minecraft getInstance() {
try {
Field f = Minecraft.class.getDeclaredField("instance");
f.setAccessible(true);
return (Minecraft) f.get(null);
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
return null;
}

public static long getRealDaysPlayed() {
int seconds = ModHelper.getInstance().statFileWriter.write(Stats.playOneMinute) / 20;
return Duration.ofSeconds(seconds).toDays();
}

public static long getGameDaysPlayed() {
int seconds = ModHelper.getInstance().statFileWriter.write(Stats.playOneMinute) / 20;
return Duration.ofSeconds(seconds).toMinutes() / 20;
}

public static float lerp(float delta, float start, float end) {
return start + delta * (end - start);
}

public static float clamp(float val, float min, float max) {
return val < min ? min : Math.min(val, max);
}

public static class ModHelperFields {

public static Boolean ENABLE_CLOUDS = true;

public static Boolean IS_LAVA_BUCKET_CONSUMED = false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.github.telvarost.finalbeta.mixin;

import com.github.telvarost.finalbeta.Config;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.At.Shift;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.client.render.entity.BipedEntityRenderer;
import net.minecraft.entity.Living;
import net.minecraft.item.ItemInstance;
import net.minecraft.item.ItemBase;

@Mixin(BipedEntityRenderer.class)
public class BipedRendererMixin {

@Inject(
method = "method_827",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/class_556;method_1862(Lnet/minecraft/entity/Living;Lnet/minecraft/item/ItemInstance;)V",
shift = Shift.BEFORE
)
)
public void finalBeta_playerRendering(Living entity, float f, CallbackInfo ci) {
if(Config.ConfigFields.FIX_BOW_MODEL) {
ItemInstance item = entity.getMonsterHeldItem(); // this may be wrong .getMonsterHeldItem()
if (item != null && item.itemId == ItemBase.bow.id) {
GL11.glRotatef(-5, 1, 0, 0);
GL11.glTranslatef(0.2F, -0.5F, 0.2F);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.github.telvarost.finalbeta.mixin;

import com.github.telvarost.finalbeta.Config;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.item.ItemBase;
import net.minecraft.item.tool.Bow;

@Mixin(Bow.class)
public class BowItemMixin {
@Inject(method = "<init>(I)V", at = @At("TAIL"))
public void finalBeta_initBow(int i, CallbackInfo ci) {
if(Config.ConfigFields.FIX_BOW_MODEL) {
ItemBase item = ((ItemBase) (Object) this);
item.setRendered3d();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//package com.github.telvarost.finalbeta.mixin;
//
//import com.github.telvarost.finalbeta.Config;
//import com.github.telvarost.finalbeta.ModHelper;
//import java.util.Random;
//
//import net.minecraft.client.Minecraft;
//import net.minecraft.client.gui.screen.container.DoubleChest;
//import net.minecraft.client.util.Session;
//import net.minecraft.entity.player.AbstractClientPlayer;
//import net.minecraft.level.Level;
//import net.minecraft.network.ClientPlayNetworkHandler;
//import org.lwjgl.input.Keyboard;
//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;
//
//import net.minecraft.container.Chest;
//import net.minecraft.entity.player.ClientPlayer;
//import net.minecraft.entity.player.PlayerBase;
//import net.minecraft.inventory.InventoryBase;
//
//@Mixin(ClientPlayer.class)
//public class ClientPlayerMixin extends AbstractClientPlayer {
//
// private Random rand = new Random();
//
// @Shadow
// public ClientPlayNetworkHandler networkHandler;
//
// public ClientPlayerMixin(Minecraft minecraft, Level arg, Session arg2, ClientPlayNetworkHandler arg3) {
// super(minecraft, arg, arg2, 0);
// this.networkHandler = arg3;
// }
//
// @Override
// public void finalBeta_openChestScreen(InventoryBase arg) {
// this.minecraft.openScreen(new DoubleChest(this.inventory, arg));
//
// if(Config.ConfigFields.ADD_MORE_SOUNDS) {
// PlayerBase player = (PlayerBase) (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"))
// public void finalBeta_closeContainer(CallbackInfo ci) {
// if(Config.ConfigFields.ADD_MORE_SOUNDS) {
// PlayerBase player = (PlayerBase) (Object) this;
// if(player.container instanceof Chest) {
// player.level.playSound(player, "random.chestclosed", 0.3f, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
// }
// }
// }
//}
Loading