-
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.
- Loading branch information
1 parent
218fc04
commit dc81174
Showing
23 changed files
with
1,013 additions
and
335 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.salliemay.uwu.combat; | ||
|
||
import com.salliemay.uwu.SallieMod; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.util.math.AxisAlignedBB; | ||
import net.minecraftforge.api.distmarker.Dist; | ||
import net.minecraftforge.event.entity.living.LivingEvent; | ||
import net.minecraftforge.eventbus.api.SubscribeEvent; | ||
import net.minecraftforge.fml.common.Mod; | ||
import org.lwjgl.opengl.GL11; | ||
|
||
@Mod.EventBusSubscriber(value = Dist.CLIENT) | ||
public class Hitbox { | ||
|
||
private static final Minecraft mc = Minecraft.getInstance(); | ||
|
||
@SubscribeEvent | ||
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) { | ||
if (SallieMod.HitBox) { | ||
LivingEntity entity = event.getEntityLiving(); | ||
|
||
double size = 3; | ||
|
||
AxisAlignedBB newBoundingBox = new AxisAlignedBB( | ||
entity.getPosX() - size, | ||
entity.getPosY(), | ||
entity.getPosZ() - size, | ||
entity.getPosX() + size, | ||
entity.getPosY() + entity.getHeight(), | ||
entity.getPosZ() + size | ||
); | ||
|
||
entity.setBoundingBox(newBoundingBox); | ||
} | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
src/main/java/com/salliemay/uwu/events/PacketReceived.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,21 @@ | ||
package com.salliemay.uwu.events; | ||
|
||
import net.minecraft.network.IPacket; | ||
import net.minecraftforge.eventbus.api.Event; | ||
|
||
public class PacketReceived extends Event { | ||
public final IPacket<?> packet; | ||
private boolean canceled; | ||
|
||
public PacketReceived(IPacket<?> packet) { | ||
this.packet = packet; | ||
} | ||
|
||
public boolean isCanceled() { | ||
return canceled; | ||
} | ||
|
||
public void cancel() { | ||
this.canceled = true; | ||
} | ||
} |
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,21 @@ | ||
package com.salliemay.uwu.events; | ||
|
||
import net.minecraft.network.IPacket; | ||
import net.minecraftforge.eventbus.api.Event; // Import the Event class | ||
|
||
public class PacketSent extends Event { | ||
public final IPacket<?> packet; | ||
private boolean canceled; | ||
|
||
public PacketSent(IPacket<?> packet) { | ||
this.packet = packet; | ||
} | ||
|
||
public boolean isCanceled() { | ||
return canceled; | ||
} | ||
|
||
public void cancel() { | ||
this.canceled = true; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ public static void tick() { | |
} else { | ||
player.setSprinting(false); | ||
} | ||
|
||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.salliemay.uwu.player; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.screen.ChatScreen; | ||
import net.minecraft.client.gui.screen.inventory.ContainerScreen; | ||
import net.minecraft.client.settings.KeyBinding; | ||
import net.minecraftforge.client.event.InputEvent; | ||
import net.minecraftforge.event.TickEvent; | ||
import net.minecraftforge.eventbus.api.SubscribeEvent; | ||
import net.minecraftforge.fml.common.Mod; | ||
|
||
@Mod.EventBusSubscriber | ||
public class InventoryMove { | ||
private static final Minecraft mc = Minecraft.getInstance(); | ||
|
||
// Movement key flags | ||
private static boolean isMovingForward = false; | ||
private static boolean isMovingBackward = false; | ||
private static boolean isMovingLeft = false; | ||
private static boolean isMovingRight = false; | ||
|
||
@SubscribeEvent | ||
public static void onKeyInput(InputEvent.KeyInputEvent event) { | ||
if (mc.currentScreen instanceof ContainerScreen && !(mc.currentScreen instanceof ChatScreen)) { | ||
KeyBinding forwardKey = mc.gameSettings.keyBindForward; | ||
KeyBinding backKey = mc.gameSettings.keyBindBack; | ||
KeyBinding leftKey = mc.gameSettings.keyBindLeft; | ||
KeyBinding rightKey = mc.gameSettings.keyBindRight; | ||
|
||
// Update movement state based on key presses | ||
isMovingForward = forwardKey.isKeyDown(); | ||
isMovingBackward = backKey.isKeyDown(); | ||
isMovingLeft = leftKey.isKeyDown(); | ||
isMovingRight = rightKey.isKeyDown(); | ||
|
||
} | ||
} | ||
|
||
@SubscribeEvent | ||
public static void onClientTick(TickEvent.ClientTickEvent event) { | ||
if (mc.player != null && mc.currentScreen instanceof ContainerScreen && !(mc.currentScreen instanceof ChatScreen)) { | ||
mc.player.setMotion(0, mc.player.getMotion().y, 0); | ||
|
||
float speed = 0.1F; | ||
|
||
if (isMovingForward) { | ||
mc.player.setMotion(mc.player.getMotion().x, mc.player.getMotion().y, -speed); // Move forward | ||
} | ||
if (isMovingBackward) { | ||
mc.player.setMotion(mc.player.getMotion().x, mc.player.getMotion().y, speed); // Move backward | ||
} | ||
if (isMovingLeft) { | ||
mc.player.setMotion(-speed, mc.player.getMotion().y, mc.player.getMotion().z); // Strafe left | ||
} | ||
if (isMovingRight) { | ||
mc.player.setMotion(speed, mc.player.getMotion().y, mc.player.getMotion().z); // Strafe right | ||
} | ||
|
||
if (mc.gameSettings.keyBindJump.isPressed() && mc.player.isOnGround()) { | ||
mc.player.jump(); | ||
System.out.println("Player jumped"); | ||
} | ||
|
||
System.out.println("Player Motion X: " + mc.player.getMotion().x); | ||
System.out.println("Player Motion Y: " + mc.player.getMotion().y); | ||
System.out.println("Player Motion Z: " + mc.player.getMotion().z); | ||
} | ||
} | ||
} |
Oops, something went wrong.