Jump to content

Contomman

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Contomman

  1. Im not quite sure how do do that either, im working on a different bit of my mod right now, but I know if you look at the code for defining the RenderType you can give it variables for lighting (there is one called lightmap), but I havent tried changing it yet. That part of the code doesnt seem to be fully mapped out yet, even on the latest mappings, so there is still alot of obfuscated variables. Let me know If you get it working. Ill message you if I ever get that far.
  2. I had a very similar problem. What fixes it is replacing double x = entity.lastTickPosX + (entity.getPosX() - entity.lastTickPosX) * (double) event.getPartialTicks(); double y = entity.lastTickPosY + (entity.getPosY() - entity.lastTickPosY) * (double) event.getPartialTicks(); double z = entity.lastTickPosZ + (entity.getPosZ() - entity.lastTickPosZ) * (double) event.getPartialTicks(); with Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView(); matrixStack.translate(-projectedView.x, -projectedView.y+128, -projectedView.z); (replacing the old matrixStack.translate call in the proper place obviously) When I had it using .getPartialTicks(), my rendering disappeared while I was moving. Not sure the technical reason behind this, but switching to projectedView works.
  3. Works Great. Thanks for your patience lol. should have read the docs more carefully
  4. Sure. Here is my Event Handler package com.example.examplemod.events; import com.example.examplemod.ExampleMod; import net.minecraft.entity.LivingEntity; import net.minecraft.potion.EffectInstance; import net.minecraft.potion.Effects; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.player.ArrowNockEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = ExampleMod.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE) public class TestEventHandler{ @SubscribeEvent public void onJumpEvent(EntityItemPickupEvent event) { ExampleMod.LOGGER.info("Event Fired"); } } And here is the main class package com.example.examplemod; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.stream.Collectors; // The value here should match an entry in the META-INF/mods.toml file @Mod("examplemod") public class ExampleMod { // Directly reference a log4j logger. public static final Logger LOGGER = LogManager.getLogger(); public static final String MODID = "examplemod"; public static ExampleMod instance; public ExampleMod() { instance = this; // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { } private void doClientStuff(final FMLClientSetupEvent event) { } private void enqueueIMC(final InterModEnqueueEvent event) { InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { } } Ive made a (poorly recorded,sorry) video of me building the project and trying to trigger the event, without success. I have tried several events, such as EntityItemPickupEvent and ArrowNockEvent, and I cant get any logger output, system output, potion effects triggering, etc. This is a newly created mod for the purpose of showing this issue, so there shouldn't be any other interactions I am causing, to the best of my knowledge.
  5. Sorry about that. Unfortunately I am not getting a result using LivingEvent.LivingJumpEvent either. I have also tried using EntityItemPickupEvent, as shown in the docs https://mcforge.readthedocs.io/en/latest/events/intro/
  6. I have tried many different events and effects in the code below, and I have never gotten the event to fire. The project builds and the client launches without errors. Other aspects of my mod work fine, such as registering new items and blocks with the EventBusSubscriber, so I am not sure why I cant detect other events. @Mod.EventBusSubscriber(modid = ExampleMod.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE) public class TestEventHandler{ @SubscribeEvent public void onJumpEvent(PlayerEvent.LivingJumpEvent event) { ExampleMod.LOGGER.info("Event Fired"); LivingEntity livingEntity = event.getEntityLiving(); livingEntity.addPotionEffect(new EffectInstance(Effects.JUMP_BOOST,600,255)); } } I tried to make a minimum working example, so I made a new mod with only the above class added. For good measure here is the main class, In case I am missing something there. It is mostly Unmodified. @Mod("examplemod") public class ExampleMod { // Directly reference a log4j logger. public static final Logger LOGGER = LogManager.getLogger(); public static final String MODID = "examplemod"; public static ExampleMod instance; public ExampleMod() { instance = this; // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { } private void doClientStuff(final FMLClientSetupEvent event) { } private void enqueueIMC(final InterModEnqueueEvent event) { InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { } } Here is my latest log file. I didnt see anything out of the ordinary in it https://pastebin.com/2L3gdHrE ***SOLVED EDIT*** I did not make my method static, which Is required to automatically register the class without passing the eventbus an instance of the class, as outlined in https://mcforge.readthedocs.io/en/latest/events/intro/.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.