generated from neoforged/MDK
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c40e769
commit e0e8b96
Showing
17 changed files
with
173 additions
and
99 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
24 changes: 0 additions & 24 deletions
24
src/main/java/com/leclowndu93150/flightutils/FlightUtilsMain.java
This file was deleted.
Oops, something went wrong.
53 changes: 0 additions & 53 deletions
53
src/main/java/com/leclowndu93150/flightutils/events/AngelRingEvents.java
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
src/main/java/com/leclowndu93150/modular_angelring/AngelRingMain.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,23 @@ | ||
package com.leclowndu93150.modular_angelring; | ||
|
||
import com.leclowndu93150.modular_angelring.common.AngelRingItem; | ||
import com.leclowndu93150.modular_angelring.registry.CreativeTabRegistry; | ||
import com.leclowndu93150.modular_angelring.registry.DataComponentRegistry; | ||
import com.leclowndu93150.modular_angelring.registry.ItemRegistry; | ||
import net.neoforged.bus.api.IEventBus; | ||
import net.neoforged.fml.common.Mod; | ||
|
||
@Mod(AngelRingMain.MODID) | ||
public class AngelRingMain { | ||
public static final String MODID = "modular_angelring"; | ||
|
||
|
||
|
||
public AngelRingMain(IEventBus modEventBus) { | ||
CreativeTabRegistry.CREATIVE_MODE_TABS.register(modEventBus); | ||
ItemRegistry.ITEMS.register(modEventBus); | ||
DataComponentRegistry.COMPONENTS.register(modEventBus); | ||
modEventBus.addListener(AngelRingItem::registerCapabilities); | ||
} | ||
|
||
} |
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
4 changes: 2 additions & 2 deletions
4
.../flightutils/common/AngelRingModules.java → ...ar_angelring/common/AngelRingModules.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
54 changes: 54 additions & 0 deletions
54
src/main/java/com/leclowndu93150/modular_angelring/events/AngelRingEvents.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,54 @@ | ||
package com.leclowndu93150.modular_angelring.events; | ||
|
||
import com.leclowndu93150.modular_angelring.AngelRingMain; | ||
import com.leclowndu93150.modular_angelring.registry.ItemRegistry; | ||
import com.leclowndu93150.modular_angelring.registry.KeyBindRegistry; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.Options; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.phys.Vec3; | ||
import net.neoforged.bus.api.EventPriority; | ||
import net.neoforged.bus.api.SubscribeEvent; | ||
import net.neoforged.fml.common.EventBusSubscriber; | ||
import net.neoforged.neoforge.event.entity.player.PlayerEvent; | ||
import net.neoforged.neoforge.event.tick.PlayerTickEvent; | ||
import top.theillusivec4.curios.api.CuriosApi; | ||
import top.theillusivec4.curios.api.SlotResult; | ||
|
||
import java.util.Optional; | ||
|
||
import static com.leclowndu93150.modular_angelring.common.AngelRingModules.getInertiaModifier; | ||
import static com.leclowndu93150.modular_angelring.common.AngelRingModules.getMiningSpeedModifier; | ||
|
||
@EventBusSubscriber(modid = AngelRingMain.MODID) | ||
public class AngelRingEvents { | ||
|
||
@SubscribeEvent(priority = EventPriority.LOW) | ||
public static void setRingBreakSpeed(PlayerEvent.BreakSpeed event) { | ||
ItemStack angelRingStack = CuriosApi.getCuriosHelper().getCuriosHandler(event.getEntity()).get().findFirstCurio(ItemRegistry.ANGEL_RING.get()).get().stack(); | ||
float newDigSpeed = event.getOriginalSpeed(); | ||
if (getMiningSpeedModifier(angelRingStack) && !event.getEntity().onGround() && KeyBindRegistry.miningEnabled) { | ||
newDigSpeed *= 5f; | ||
} | ||
if (newDigSpeed != event.getOriginalSpeed()) { | ||
event.setNewSpeed(newDigSpeed); | ||
} | ||
} | ||
|
||
@SubscribeEvent(priority = EventPriority.LOW) | ||
public static void stopDrift(PlayerTickEvent.Pre event) { | ||
Optional<SlotResult> slotResult = CuriosApi.getCuriosHelper().getCuriosHandler(event.getEntity()).flatMap(curiosHandler -> curiosHandler.findFirstCurio(ItemRegistry.ANGEL_RING.get())); | ||
if (slotResult.isPresent()) { | ||
ItemStack angelRingStack = slotResult.get().stack(); | ||
Vec3 motion = event.getEntity().getDeltaMovement(); | ||
if (event.getEntity().getAbilities().flying && getInertiaModifier(angelRingStack) && KeyBindRegistry.inertiaEnabled) { | ||
Options opt = Minecraft.getInstance().options; | ||
if (!opt.keyUp.isDown() && !opt.keyDown.isDown() && !opt.keyLeft.isDown() && !opt.keyRight.isDown()) { | ||
if (motion.x != 0 || motion.z != 0) { | ||
event.getEntity().setDeltaMovement(0, motion.y, 0); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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
6 changes: 3 additions & 3 deletions
6
...50/flightutils/registry/ItemRegistry.java → ...ular_angelring/registry/ItemRegistry.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
44 changes: 44 additions & 0 deletions
44
src/main/java/com/leclowndu93150/modular_angelring/registry/KeyBindRegistry.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,44 @@ | ||
package com.leclowndu93150.modular_angelring.registry; | ||
|
||
import com.mojang.blaze3d.platform.InputConstants; | ||
import net.minecraft.client.KeyMapping; | ||
import net.neoforged.bus.api.SubscribeEvent; | ||
import net.neoforged.fml.common.EventBusSubscriber; | ||
import net.neoforged.neoforge.client.event.InputEvent; | ||
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent; | ||
import net.neoforged.neoforge.common.NeoForge; | ||
import net.neoforged.neoforge.common.util.Lazy; | ||
import org.lwjgl.glfw.GLFW; | ||
|
||
import static com.leclowndu93150.modular_angelring.AngelRingMain.MODID; | ||
|
||
@EventBusSubscriber(modid = MODID, bus = EventBusSubscriber.Bus.MOD) | ||
public class KeyBindRegistry { | ||
|
||
public static final Lazy<KeyMapping> MINING_MODULE = Lazy.of(() ->new KeyMapping( | ||
"key." + MODID + ".mining_module", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_M, "key.modular_angelring.misc")); | ||
|
||
public static final Lazy<KeyMapping> INERTIA_MODULE = Lazy.of(() ->new KeyMapping( | ||
"key." + MODID + ".inertia_module", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_L, "key.modular_angelring.misc")); | ||
|
||
|
||
@SubscribeEvent | ||
public static void registerBindings(RegisterKeyMappingsEvent event) { | ||
event.register(MINING_MODULE.get()); | ||
event.register(INERTIA_MODULE.get()); | ||
NeoForge.EVENT_BUS.addListener(KeyBindRegistry::onKey); | ||
} | ||
|
||
public static boolean miningEnabled = true; | ||
public static boolean inertiaEnabled = true; | ||
public static void onKey(InputEvent.Key event){ | ||
if(MINING_MODULE.get().consumeClick()){ | ||
miningEnabled = !miningEnabled; | ||
} | ||
if (INERTIA_MODULE.get().consumeClick()){ | ||
inertiaEnabled = !inertiaEnabled; | ||
} | ||
} | ||
|
||
|
||
} |
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,6 @@ | ||
{ | ||
"item.modular_angelring.angel_ring": "Angel Ring", | ||
"item.modular_angelring.inertia_module": "Inertia Module", | ||
"item.modular_angelring.mining_module": "Mining Module", | ||
"curios.identifier.angel_ring": "Angel Ring" | ||
} |
File renamed without changes
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,6 +1,6 @@ | ||
{ | ||
"replace": true, | ||
"values": [ | ||
"flightutils:angel_ring" | ||
"modular_angelring:angel_ring" | ||
] | ||
} |
4 changes: 0 additions & 4 deletions
4
src/main/resources/data/flightutils/curios/slots/angel_ring.json
This file was deleted.
Oops, something went wrong.
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
src/main/resources/data/modular_angelring/curios/slots/angel_ring.json
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,4 @@ | ||
{ | ||
"size": 1, | ||
"icon": "modular_angelring:slot/empty_angel_ring_slot" | ||
} |