Skip to content

Commit

Permalink
fix client crashes with occulus and crystal wrench (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
Minecraftschurli authored Apr 9, 2022
1 parent 139219a commit 125dd06
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ body:
- 1.18.1-0.1.4
- 1.18.1-0.1.5
- 1.18.2-1.0.0
- 1.18.2-1.0.1
validations:
required: true
- type: input
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.daemon=false
mod_group=com.github.minecraftschurli
mod_id=arsmagicalegacy
mod_name=Ars Magica: Legacy
mod_version=1.0.0
mod_version=1.0.1
mod_author=Minecraftschurli, IchHabeHunger54
mod_credits=Mithion for the original mod
mod_url=https://www.curseforge.com/minecraft/mc-mods/ars-magica-legacy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.github.minecraftschurlimods.arsmagicalegacy.common.EventHandler;
import com.github.minecraftschurlimods.arsmagicalegacy.common.affinity.AffinityHelper;
import com.github.minecraftschurlimods.arsmagicalegacy.common.block.altar.AltarMaterialManager;
import com.github.minecraftschurlimods.arsmagicalegacy.common.block.obelisk.ObeliskFuelManager;
import com.github.minecraftschurlimods.arsmagicalegacy.common.etherium.EtheriumHelper;
import com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMRegistries;
import com.github.minecraftschurlimods.arsmagicalegacy.common.magic.BurnoutHelper;
Expand Down Expand Up @@ -67,6 +68,7 @@ public ArsMagicaLegacy() {
SkillManager.instance();
SpellDataManager.instance();
AltarMaterialManager.instance();
ObeliskFuelManager.instance();
CompatManager.preInit();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected void renderFg(PoseStack stack, int mouseX, int mouseY, float partialTi
int tick = (player.tickCount % 80) >= 40 ? (player.tickCount % 40) - 20 : -(player.tickCount % 40) + 20;
float multiplier = 0.75F + tick / 80F;
double guiScale = getMinecraft().getWindow().getGuiScale();
RenderSystem.enableScissor((int) (posX * guiScale), (int) Math.floor((posY - 1) * guiScale), (int) (width * guiScale), (int) (height * guiScale));
RenderSystem.enableScissor((int) (posX * guiScale), (int) Math.floor(posY * guiScale), (int) (width * guiScale), (int) Math.floor(height * guiScale));
for (ISkill skill : skills) {
boolean knows = helper.knows(player, skill);
float cX = skill.getX() + SKILL_SIZE / 2 + 1;
Expand Down Expand Up @@ -145,6 +145,7 @@ protected void renderFg(PoseStack stack, int mouseX, int mouseY, float partialTi
}
RenderSystem.disableScissor();
stack.popPose();
if (!(mouseX > offsetX && mouseX < offsetX+width && mouseY > offsetY && mouseY < offsetY+height)) return;
for (ISkill skill : skills) {
if (mouseX >= skill.getX() && mouseX <= skill.getX() + SKILL_SIZE && mouseY >= skill.getY() && mouseY <= skill.getY() + SKILL_SIZE) {
List<Component> list = new ArrayList<>();
Expand All @@ -169,7 +170,7 @@ protected void renderFg(PoseStack stack, int mouseX, int mouseY, float partialTi

@Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
if (mouseButton == 0 && mouseX > 7 && mouseX < width && mouseY > 7 && mouseX < height) {
if (mouseButton == 0 && mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
var helper = ArsMagicaAPI.get().getSkillHelper();
Player player = getMinecraft().player;
if (player != null && hoverItem != null && !helper.knows(player, hoverItem)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public CrystalWrenchItem() {

@Override
public InteractionResult useOn(UseOnContext context) {
if (context.getLevel().isClientSide()) return InteractionResult.PASS;
var helper = ArsMagicaAPI.get().getEtheriumHelper();
if (context.isSecondaryUseActive()) {
if (helper.hasEtheriumProvider(context.getLevel(), context.getClickedPos())) {
Expand Down

0 comments on commit 125dd06

Please sign in to comment.