Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jm/entity collision #18

Open
wants to merge 31 commits into
base: FD/activatorSetup
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b425e40
init
jakeee51 Oct 23, 2024
880f029
Update TestProjectileEntity.java
jakeee51 Oct 23, 2024
2c3e9e9
collision working lowkey
jakeee51 Oct 23, 2024
93f8ae9
Update TestProjectileEntity.java
jakeee51 Oct 23, 2024
4e346f1
fix runServer error
jakeee51 Oct 23, 2024
3997101
comment out unnecessary code
jakeee51 Oct 23, 2024
b06d17a
Update TestProjectileEntity.java
jakeee51 Oct 23, 2024
97c205e
refactor sendDebugMsg method
jakeee51 Oct 23, 2024
5769e30
Update ServerEvents.java
jakeee51 Oct 23, 2024
71b61af
run multiple clients with dif users
jakeee51 Oct 25, 2024
7ef6106
multiplayer fx working!
jakeee51 Oct 25, 2024
caf1577
clean up some prints
jakeee51 Oct 25, 2024
e287b69
fix custom username arg
jakeee51 Oct 25, 2024
bea2005
exclude player that fires
jakeee51 Oct 25, 2024
431fbea
no need to check entityId
jakeee51 Oct 25, 2024
bd9723c
use PacketDistributor to send to nearby clients
jakeee51 Oct 25, 2024
ac3d6a9
create a command to trigger forms on specified player
jakeee51 Oct 27, 2024
09f642f
improved entity collision
jakeee51 Oct 28, 2024
8521d9a
fixed bugs with singleplayer/multiplayer vs client/server
jakeee51 Oct 28, 2024
0e784cd
move gravity setting
jakeee51 Oct 28, 2024
7cd1c33
refactor
jakeee51 Oct 28, 2024
8674a31
started implementing generic element entity handling system
jakeee51 Oct 29, 2024
1fa53dd
Update AvatarCommand.java
jakeee51 Oct 29, 2024
f544186
Update ElementCollision.java
jakeee51 Oct 29, 2024
400dad6
Update ElementCollision.java
jakeee51 Oct 29, 2024
73325d1
clean up
jakeee51 Oct 29, 2024
4e4c93d
entity spawning system stable
jakeee51 Oct 29, 2024
735a092
fix commands
jakeee51 Oct 30, 2024
4f1c3d1
Update InputModule.java
jakeee51 Oct 30, 2024
31c9a6c
fix toString
jakeee51 Oct 30, 2024
31e70cb
implemented arc form & collisions
jakeee51 Nov 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ minecraft {
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
// Set custom username
args "--username", "Dev####"
}

server {
Expand Down
48 changes: 16 additions & 32 deletions src/main/java/com/amuzil/omegasource/magus/Magus.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package com.amuzil.omegasource.magus;

import com.amuzil.omegasource.magus.input.*;
import com.amuzil.omegasource.magus.entity.AvatarEntities;
import com.amuzil.omegasource.magus.input.InputModule;
import com.amuzil.omegasource.magus.input.KeyboardMouseInputModule;
import com.amuzil.omegasource.magus.input.MouseMotionModule;
import com.amuzil.omegasource.magus.network.MagusNetwork;
import com.amuzil.omegasource.magus.registry.Registries;
import com.amuzil.omegasource.magus.skill.forms.FormDataRegistry;
import com.amuzil.omegasource.magus.skill.forms.Forms;
import com.amuzil.omegasource.magus.skill.modifiers.ModifiersRegistry;
import com.amuzil.omegasource.magus.skill.test.avatar.AvatarCommand;
import com.amuzil.omegasource.magus.skill.test.avatar.AvatarEntities;
import com.amuzil.omegasource.magus.skill.util.capability.CapabilityHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.entity.EntityRenderers;
import net.minecraft.client.renderer.entity.ThrownItemRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.Entity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.server.ServerStartingEvent;
Expand Down Expand Up @@ -47,11 +46,6 @@ public class Magus {
public static InputModule mouseMotionModule;

public Magus() {
// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);
//Register the input modules
keyboardMouseInputModule = new KeyboardMouseInputModule();
mouseMotionModule = new MouseMotionModule();
// Register capabilities
FMLJavaModLoadingContext.get().getModEventBus().addListener(CapabilityHandler::registerCapabilities);
// attach capabilities
Expand All @@ -65,6 +59,9 @@ public Magus() {
// Register the doClientStuff method for mod loading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);

// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);

// Register Testing Entities
// NOTE: This is strictly for testing and to be deleted later
AvatarEntities.register(FMLJavaModLoadingContext.get().getModEventBus());
Expand All @@ -75,13 +72,15 @@ private void setup(final FMLCommonSetupEvent event) {
Registries.init();
CapabilityHandler.initialiseCaps();
MagusNetwork.registerMessages();
Forms.init();
}

private void doClientStuff(final FMLClientSetupEvent event) {
// do something that can only be done on the client
//todo call this anytime the key mappings are updated
//Assign input data to forms
// Register the input modules
keyboardMouseInputModule = new KeyboardMouseInputModule();
mouseMotionModule = new MouseMotionModule();
// TODO - call this anytime the key mappings are updated
// Assign input data to forms
FormDataRegistry.init();
ModifiersRegistry.init();
}
Expand Down Expand Up @@ -119,27 +118,12 @@ public static void onClientSetup(FMLClientSetupEvent event) {
LOGGER.info("HELLO FROM CLIENT SETUP");

KeyboardMouseInputModule.determineMotionKeys();
EntityRenderers.register(AvatarEntities.TEST_PROJECTILE.get(), ThrownItemRenderer::new);
EntityRenderers.register(AvatarEntities.AIR_PROJECTILE_ENTITY_TYPE.get(), ThrownItemRenderer::new);
EntityRenderers.register(AvatarEntities.WATER_PROJECTILE_ENTITY_TYPE.get(), ThrownItemRenderer::new);
EntityRenderers.register(AvatarEntities.EARTH_PROJECTILE_ENTITY_TYPE.get(), ThrownItemRenderer::new);
EntityRenderers.register(AvatarEntities.FIRE_PROJECTILE_ENTITY_TYPE.get(), ThrownItemRenderer::new);

LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName());
}
}

// Send a message to in-game chat
public static void sendDebugMsg(String msg) {
Minecraft minecraft = Minecraft.getInstance();
if (minecraft == null) {
System.err.println("sendDebugMsg failed: Minecraft instance is null");
return;
}
minecraft.execute(() -> {
LocalPlayer player = minecraft.player;
if (player != null) {
Component text = Component.literal(msg);
player.sendSystemMessage(text);
} else {
System.err.println("sendDebugMsg failed: player is null");
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.amuzil.omegasource.magus.entity;

import com.amuzil.omegasource.magus.Magus;
import com.amuzil.omegasource.magus.entity.collision.ElementCollision;
import com.amuzil.omegasource.magus.entity.projectile.AirProjectile;
import com.amuzil.omegasource.magus.entity.projectile.EarthProjectile;
import com.amuzil.omegasource.magus.entity.projectile.FireProjectile;
import com.amuzil.omegasource.magus.entity.projectile.WaterProjectile;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;


public class AvatarEntities {
public static final DeferredRegister<EntityType<?>> ENTITY_TYPES =
DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, Magus.MOD_ID);

public static final RegistryObject<EntityType<AirProjectile>> AIR_PROJECTILE_ENTITY_TYPE =
ENTITY_TYPES.register("air_projectile", () -> EntityType.Builder.<AirProjectile>of(AirProjectile::new, MobCategory.MISC)
.sized(0.5f, 0.5f).build("air_projectile"));

public static final RegistryObject<EntityType<WaterProjectile>> WATER_PROJECTILE_ENTITY_TYPE =
ENTITY_TYPES.register("water_projectile", () -> EntityType.Builder.<WaterProjectile>of(WaterProjectile::new, MobCategory.MISC)
.sized(0.5f, 0.5f).build("water_projectile"));

public static final RegistryObject<EntityType<EarthProjectile>> EARTH_PROJECTILE_ENTITY_TYPE =
ENTITY_TYPES.register("earth_projectile", () -> EntityType.Builder.<EarthProjectile>of(EarthProjectile::new, MobCategory.MISC)
.sized(0.5f, 0.5f).build("earth_projectile"));

public static final RegistryObject<EntityType<FireProjectile>> FIRE_PROJECTILE_ENTITY_TYPE =
ENTITY_TYPES.register("fire_projectile", () -> EntityType.Builder.<FireProjectile>of(FireProjectile::new, MobCategory.MISC)
.sized(0.5f, 0.5f).build("fire_projectile"));

public static final RegistryObject<EntityType<ElementCollision>> COLLISION_ENTITY_TYPE =
ENTITY_TYPES.register("element_collision", () -> EntityType.Builder.<ElementCollision>of(ElementCollision::new, MobCategory.MISC)
.sized(0.5f, 0.5f).build("element_collision"));

public static void register(IEventBus eventBus) {
ENTITY_TYPES.register(eventBus);
}
}
Loading