generated from NeoForgeMDKs/MDK-1.21-NeoGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begin Work on augmentation capabilities
- Loading branch information
Showing
5 changed files
with
82 additions
and
0 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
5 changes: 5 additions & 0 deletions
5
src/main/java/com/portingdeadmods/modjam/capabilities/augmentation/AugmentationSlot.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,5 @@ | ||
package com.portingdeadmods.modjam.capabilities.augmentation; | ||
|
||
public enum AugmentationSlot { | ||
HEAD,BODY,ARMS,LEGS,HEART | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/portingdeadmods/modjam/capabilities/augmentation/IPlayerAugmentation.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,10 @@ | ||
package com.portingdeadmods.modjam.capabilities.augmentation; | ||
|
||
import net.minecraft.nbt.CompoundTag; | ||
|
||
public interface IPlayerAugmentation { | ||
int getAugment(AugmentationSlot slot); | ||
void setAugment(AugmentationSlot slot, int value); | ||
void saveNBTData(CompoundTag tag); | ||
void loadNBTData(CompoundTag tag); | ||
} |
57 changes: 57 additions & 0 deletions
57
...va/com/portingdeadmods/modjam/capabilities/augmentation/PlayerAugmentationCapability.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,57 @@ | ||
package com.portingdeadmods.modjam.capabilities.augmentation; | ||
|
||
import net.minecraft.nbt.CompoundTag; | ||
|
||
|
||
public class PlayerAugmentationCapability implements IPlayerAugmentation { | ||
|
||
private int headId; | ||
private int bodyId; | ||
private int armsId; | ||
private int legsId; | ||
private int heartId; | ||
|
||
public int getAugment(AugmentationSlot slot){ | ||
switch (slot){ | ||
case LEGS -> { | ||
return legsId; | ||
} | ||
case ARMS -> { | ||
return armsId; | ||
} | ||
case BODY -> { | ||
return bodyId; | ||
} | ||
case HEAD -> { | ||
return headId; | ||
} | ||
case HEART -> { | ||
return heartId; | ||
} | ||
} | ||
return -2; | ||
} | ||
public void setAugment(AugmentationSlot slot, int value){ | ||
switch (slot){ | ||
case HEART -> heartId = value; | ||
case HEAD -> headId = value; | ||
case BODY -> bodyId = value; | ||
case ARMS -> armsId = value; | ||
case LEGS -> legsId = value; | ||
} | ||
} | ||
public void saveNBTData(CompoundTag tag){ | ||
tag.putInt("heart_id", heartId); | ||
tag.putInt("head_id", headId); | ||
tag.putInt("body_id", bodyId); | ||
tag.putInt("arms_id", armsId); | ||
tag.putInt("legs_id", legsId); | ||
} | ||
public void loadNBTData(CompoundTag tag){ | ||
heartId = tag.getInt("heart_id"); | ||
headId = tag.getInt("head_id"); | ||
bodyId = tag.getInt("body_id"); | ||
armsId = tag.getInt("arms_id"); | ||
legsId = tag.getInt("legs_id"); | ||
} | ||
} |
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