-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge incoming changes from 1.18.x/main
- Loading branch information
Showing
15 changed files
with
268 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Bug report | ||
description: Let us know about a bug that occurs without other mods | ||
title: '<title>' | ||
labels: bug | ||
assignees: [] | ||
body: | ||
- type: checkboxes | ||
attributes: | ||
label: This issue occurs when only Valkyrien Skies and addons are installed and no other mods | ||
options: | ||
- label: I have tested this issue and it occurs when no other mods are installed | ||
required: true | ||
- type: dropdown | ||
attributes: | ||
label: Minecraft Version | ||
description: What Minecraft version does this issue occur on? | ||
options: | ||
- 1.16 | ||
- 1.18 | ||
- 1.19 | ||
validations: | ||
required: true | ||
- type: dropdown | ||
attributes: | ||
label: Mod Loader | ||
description: What mod loader does this issue occur on? | ||
options: | ||
- Forge | ||
- Fabric | ||
- Quilt | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Issue description | ||
description: Describe what happens, and what you expect to happen instead | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Issue reproduction | ||
description: Describe how to reproduce your issue | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Logs | ||
description: Go to `.minecraft/logs` and drag and drop the `latest.log` and `debug.log` file into this text field |
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,59 @@ | ||
name: Compatibility issue | ||
description: Let us know about a bug that occurs when another mod is installed | ||
title: '<title>' | ||
labels: compat | ||
assignees: [] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
**Note:** do not report issues with the following mods: | ||
- Optifine | ||
- Magma Server (maybe try Arclight?) | ||
- type: input | ||
attributes: | ||
label: Mod Name | ||
description: The name of the mod that causes the compatibility issue | ||
validations: | ||
required: true | ||
- type: checkboxes | ||
attributes: | ||
label: This issue occurs when only Valkyrien Skies, addons, and the mod I have specified are installed and no other mods | ||
options: | ||
- label: I have tested this issue and it occurs with only Valkyrien Skies, addons, and the mod I have specified | ||
- type: dropdown | ||
attributes: | ||
label: Minecraft Version | ||
description: What Minecraft version does this issue occur on? | ||
options: | ||
- 1.16 | ||
- 1.18 | ||
- 1.19 | ||
validations: | ||
required: true | ||
- type: dropdown | ||
attributes: | ||
label: Mod Loader | ||
description: What mod loader does this issue occur on? | ||
options: | ||
- Forge | ||
- Fabric | ||
- Quilt | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Issue description | ||
description: Describe what happens, and what you expect to happen instead | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Issue reproduction | ||
description: Describe how to reproduce your issue | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Logs | ||
description: Go to `.minecraft/logs` and drag and drop the `latest.log` and `debug.log` file into this text field |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
22 changes: 22 additions & 0 deletions
22
common/src/main/java/org/valkyrienskies/mod/mixin/feature/entity_collision/MixinPlayer.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,22 @@ | ||
package org.valkyrienskies.mod.mixin.feature.entity_collision; | ||
|
||
import net.minecraft.world.entity.MoverType; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.phys.Vec3; | ||
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.CallbackInfoReturnable; | ||
import org.valkyrienskies.mod.common.util.IEntityDraggingInformationProvider; | ||
|
||
@Mixin(Player.class) | ||
public abstract class MixinPlayer implements IEntityDraggingInformationProvider { | ||
// Allow players to crouch walk on ships | ||
@Inject(method = "maybeBackOffFromEdge", at = @At("HEAD"), cancellable = true) | ||
private void preMaybeBackOffFromEdge(final Vec3 vec3, final MoverType moverType, | ||
final CallbackInfoReturnable<Vec3> callbackInfoReturnable) { | ||
if (getDraggingInformation().isEntityBeingDraggedByAShip()) { | ||
callbackInfoReturnable.setReturnValue(vec3); | ||
} | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
common/src/main/java/org/valkyrienskies/mod/mixin/feature/mass_tooltip/MixinBlockItem.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,71 @@ | ||
package org.valkyrienskies.mod.mixin.feature.mass_tooltip; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.network.chat.TranslatableComponent; | ||
import net.minecraft.world.item.BlockItem; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.TooltipFlag; | ||
import net.minecraft.world.level.Level; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.valkyrienskies.mod.common.BlockStateInfo; | ||
import org.valkyrienskies.mod.common.config.VSGameConfig; | ||
import org.valkyrienskies.mod.mixinducks.feature.mass_tooltip.MassTooltipVisibility; | ||
import oshi.util.tuples.Pair; | ||
|
||
@Mixin(BlockItem.class) | ||
public class MixinBlockItem { | ||
@Inject(method = "appendHoverText", at = @At("HEAD")) | ||
private void ValkyrienSkies$addMassToTooltip(final ItemStack itemStack, final Level level, | ||
final List<Component> list, final TooltipFlag tooltipFlag, final CallbackInfo ci) { | ||
final MassTooltipVisibility visibility = VSGameConfig.CLIENT.getTooltip().getMassTooltipVisibility(); | ||
if (visibility.isVisible(tooltipFlag)) { | ||
try { | ||
final BlockItem item = (BlockItem) itemStack.getItem(); | ||
final Double mass = | ||
Objects.requireNonNull(BlockStateInfo.INSTANCE.get(item.getBlock().defaultBlockState())) | ||
.getFirst(); | ||
list.add(new TranslatableComponent("tooltip.valkyrienskies.mass") | ||
.append(VSGameConfig.CLIENT.getTooltip().getUseImperialUnits() ? | ||
getImperialText(mass) : ": " + mass + "kg").withStyle(ChatFormatting.DARK_GRAY)); | ||
} catch (final Exception ignored) { | ||
} | ||
} | ||
} | ||
|
||
@Unique | ||
private Pair<Integer, Integer> convertToImperial(final double mass) { | ||
final double ounces = mass * 35.274; | ||
final double pounds = Math.floor(ounces / 16); | ||
return new Pair<>( | ||
(int) pounds, | ||
(int) Math.floor((ounces / 16 - pounds) * 16) | ||
); | ||
} | ||
|
||
@Unique | ||
private String getImperialText(final double mass) { | ||
String impText = ": "; | ||
final Pair<Integer, Integer> imperial = convertToImperial(mass); | ||
if (imperial.getA() > 0) { | ||
impText = impText + imperial.getA(); | ||
if (imperial.getA() == 1) { | ||
impText = impText + "lb. "; | ||
} else { | ||
impText = impText + "lbs. "; | ||
} | ||
} | ||
|
||
if (imperial.getB() > 0) { | ||
impText = impText + imperial.getB() + "oz."; | ||
} | ||
|
||
return impText; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...in/java/org/valkyrienskies/mod/mixinducks/feature/mass_tooltip/MassTooltipVisibility.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,14 @@ | ||
package org.valkyrienskies.mod.mixinducks.feature.mass_tooltip; | ||
|
||
import net.minecraft.world.item.TooltipFlag; | ||
|
||
public enum MassTooltipVisibility { | ||
ALWAYS, | ||
ADVANCED, | ||
DISABLED; | ||
|
||
public boolean isVisible(final TooltipFlag flag) { | ||
return this.equals(ALWAYS) || | ||
(this.equals(ADVANCED) && flag.isAdvanced()); | ||
} | ||
} |
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
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
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
Submodule vs-core
updated
from ead972 to 9c5b34