-
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.
Merge pull request #2 from Erdragh/develop
implement hover mode
- Loading branch information
Showing
7 changed files
with
97 additions
and
6 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
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
28 changes: 28 additions & 0 deletions
28
src/main/java/com/github/erdragh/jet_suit_additions/mixin/PlayerEntityMixin.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,28 @@ | ||
package com.github.erdragh.jet_suit_additions.mixin; | ||
|
||
import com.github.alexnijjar.ad_astra.AdAstra; | ||
import com.github.alexnijjar.ad_astra.util.ModKeyBindings; | ||
import com.github.erdragh.jet_suit_additions.items.armour.ImprovedJetSuit; | ||
import net.minecraft.entity.EquipmentSlot; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.ItemStack; | ||
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; | ||
|
||
@Mixin(PlayerEntity.class) | ||
public class PlayerEntityMixin { | ||
@Inject(method = "tick", at = @At("TAIL")) | ||
public void jet_suit_additions_tick(CallbackInfo ci) { | ||
if (AdAstra.CONFIG.spaceSuit.enableJetSuitFlight) { | ||
PlayerEntity player = ((PlayerEntity) (Object) this); | ||
if (!player.hasVehicle() && !ModKeyBindings.jumpKeyDown(player)) { | ||
ItemStack chest = player.getEquippedStack(EquipmentSlot.CHEST); | ||
if (chest.getItem() instanceof ImprovedJetSuit jetSuit && ImprovedJetSuit.hasFullSet(player) && chest.getOrCreateNbt().getBoolean("toggle_hover")) { | ||
jetSuit.fly(player, chest); | ||
} | ||
} | ||
} | ||
} | ||
} |
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,8 +1,10 @@ | ||
{ | ||
"jet_suit_additions.msg.jet_suit_toggle": "Jet Suit turned ", | ||
"jet_suit_additions.msg.jet_suit_toggle_hover": "Jet Suit Hover turned ", | ||
"jet_suit_additions.msg.jet_suit_on": "on", | ||
"jet_suit_additions.msg.jet_suit_off": "off", | ||
|
||
"jet_suit_additions.key_category": "Jet Suit Additions", | ||
"jet_suit_additions.key.toggle_jet_suit": "Turn the Jet Suit on/off" | ||
"jet_suit_additions.key.toggle_jet_suit": "Turn the Jet Suit on/off", | ||
"jet_suit_additions.key.toggle_jet_suit_hover": "Turn Hover Mode on/off" | ||
} |
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