Jump to content

Tim Graupmann

Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by Tim Graupmann

  1. Biome biome = event.world.getBiome(mPlayerState.mPosition); logMessage("biome: "+biome+ " tenp "+biome.getTemperature(mPlayerState.mPosition)); Checking the biome temp reports around 0.14 but I get the same low temps for rain and snow areas. I'd figure snow would be at temps 32F/0C or below. I might use the condition if the player is on snow covered block or snow tile at the player position. boolean isRaining = false; boolean isSnowing = false; if (event.world.isRainingAt(mPlayerState.mPosition)) { BlockState blockState = event.world.getBlockState(mPlayerState.mPosition); if (blockState.getBlock() == Blocks.SNOW || blockState.getBlock() == Blocks.SNOW_BLOCK) { isSnowing = true; } else { Biome biome = event.world.getBiome(mPlayerState.mPosition); switch (biome.getPrecipitation()) { case RAIN: isRaining = true; break; case SNOW: isSnowing = true; break; } } } This works well enough...
  2. When I'm checking `isRainingAt` I'm seeing it return true for both SNOW and RAIN.
  3. Minecart and detecting rain works. I can detect RAIN, I haven't seen SNOW reported yet. Even when I'm standing in snow or flying through it getPrecipitation reports RAIN. boolean isRaining = false; boolean isSnowing = false; if (event.world.isRainingAt(mPlayerState.mPosition)) { Biome biome = event.world.getBiome(mPlayerState.mPosition); switch (biome.getPrecipitation()) { case RAIN: isRaining = true; break; case SNOW: isSnowing = true; break; } }
  4. Is there a weather event for rain and snow? I searched the source and I found Biomes with snow, but I don't think that's the same thing. I found there's a player.isOnLadder(), is there something for isInMinecart? https://github.com/tgraupmann/MinecraftChromaMod/blob/master/src/main/java/com/example/examplemod/MyForgeEventHandler.java Thanks!
  5. I can't actually move the thread. Can a moderator move it? I renamed the topic...
  6. I found a workaround by embedding the SVG content on the HTML page. Okay now I can make some better video.
  7. I integrated some scalable SVG widgets that I can show on top of the video. I have to work out some SVG content document issues on the streaming platforms before I can use it on a live stream. ugh... https://github.com/tgraupmann/Mixer-Sample-SVG
  8. Thanks for the hints. I'm going to spend a day on those video Chroma widgets. It's hard to see on the side and I'll make it so they appear on top of the game so they can be bigger and easier to see the lighting patterns.
  9. Here's a video where you can see it working. Source code: https://github.com/tgraupmann/MinecraftChromaMod/blob/master/src/main/java/com/example/examplemod/MyForgeEventHandler.java I'll add more Chroma effects for the various events as I figure things out... Things to figure out: * Attack with a sword * Place a block * Ride in a cart * Crafting * Destroy a block * Climb a ladder * Get hurt by a creeper * Kill a pig * Drink a potion * Stand near a chicken * Walk through a portal * Place a fish * Swim through bubbles * Weather snow * Weather rain
  10. And it's working with the upgraded Chroma library. First there's a C++ DLL and I have a tool that parses the C++ header to get all the nice helper functions and comments. https://github.com/tgraupmann/ChromaAPISync/blob/master/bin/Debug/stdafx.h And then the DLL interface library is generated. https://github.com/tgraupmann/ChromaAPISync/blob/master/bin/Debug/JChromaLib.java And then the wrapper Java is generated. https://github.com/tgraupmann/ChromaAPISync/blob/master/bin/Debug/JChromaSDK.java This gets copied over to the Java Chroma library. https://github.com/tgraupmann/JChroma And then it's ready for the Minecraft mod. https://github.com/tgraupmann/MinecraftChromaMod/blob/master/src/main/java/com/example/examplemod/MyForgeEventHandler.java This exposes the nice API from the guide to Java. http://chroma.razer.com/ChromaGuide/
  11. I have Chroma effects playing with some temporary API calls from JChroma. https://github.com/tgraupmann/JChroma I need to expose the C++ API to JAVA. https://github.com/razerofficial/CChromaEditor I just need to expose the basics like setting the idle animation, playing an animation with/without looping, and copy/add/subtract layers.
  12. Okay it seems like the Minecraft Forge has trouble building with Oracle's JAVA. C:\Users\timot\Downloads\forge-1.12.2-14.23.5.2844-mdk>gradlew.bat setupDecompWorkspace To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/2.14/userguide/gradle_daemon.html. This mapping 'snapshot_20171003' was designed for MC 1.12! Use at your own peril. ################################################# ForgeGradle 2.3-SNAPSHOT-7764e3e https://github.com/MinecraftForge/ForgeGradle ################################################# Powered by MCP http://modcoderpack.com by: Searge, ProfMobius, R4wk, ZeuX Fesh0r, IngisKahn, bspkrs, LexManos ################################################# :deobfCompileDummyTask :deobfProvidedDummyTask :getVersionJson :extractUserdev UP-TO-DATE :extractDependencyATs SKIPPED :extractMcpData SKIPPED :extractMcpMappings SKIPPED :genSrgs SKIPPED :downloadClient SKIPPED :downloadServer SKIPPED :splitServerJar SKIPPED :mergeJars SKIPPED :deobfMcSRG SKIPPED :decompileMc SKIPPED :fixMcSources :applySourcePatches Patching failed: cp/MethodsReturnNonnullByDefault.java Cannot find hunk target 1: Cannot find hunk target @ 0 1/1 failed :applySourcePatches FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':applySourcePatches'. > com.cloudbees.diff.PatchException: Cannot find hunk target * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 32.666 secs I upgraded gradle to the latest 5.6.1. gradlew wrapper --gradle-version=5.6.1 gradlew -v I had those same build errors for the latest MCF stable version, so I went right for the latest. https://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.14.4.html gradlew eclipse This runs for a while...
  13. Okay here's the first part. I checked into a public repository. https://github.com/tgraupmann/MinecraftChromaMod Currently it's just doing some print logging when events happen. I have another Chroma RGB to integrate once I have the events in place. I'll see about upgrading Minecraft Forge next... This is where the interesting code is. https://github.com/tgraupmann/MinecraftChromaMod/blob/master/src/main/java/com/example/examplemod/MyForgeEventHandler.java Grabbing the sample source and upgrading gradle, running the setup/etc. https://mcforge.readthedocs.io/en/latest/gettingstarted/
  14. Ah Logan is my kid's computer that I used when doing homework with the kids. And yes, I'll put the mod on github when I'm done. That's the plan. I'll probably have my sandbox version here - https://github.com/tgraupmann And the official version here - https://github.com/RazerOfficial/
  15. I'm headed to PAX West Seattle on Friday and I have to get Razer things ready for the rest of the week. I'll get back on this next week and upgrade my version. If you are at PAX, check out the Razer booth. https://west.paxsite.com/
  16. I'm running MC 1.11.2 which was part of a modding course. It's worth upgrading for the easy syntax.
  17. Thanks cleaned up the strings. @SubscribeEvent public void handleRightClickBlock(RightClickBlock event) { final BlockPos pos = event.getPos(); final World world = event.getWorld(); new java.util.Timer().schedule(new java.util.TimerTask() { @Override public void run() { IBlockState blockState = world.getBlockState(pos); if (null != blockState) { StateImplementation state = (StateImplementation) blockState; Block block = state.getBlock(); if (block == Blocks.ACACIA_DOOR || block == Blocks.BIRCH_DOOR || block == Blocks.DARK_OAK_DOOR || block == Blocks.IRON_DOOR || block == Blocks.JUNGLE_DOOR || block == Blocks.SPRUCE_DOOR || block == Blocks.OAK_DOOR) { for (IProperty<?> p : state.getPropertyKeys()) { if (p.getName().equals("open")) { if ((boolean) state.getValue(p)) { System.out.println("Door is open"); } else { System.out.println("Door is closed"); } break; } } } } } }, 250 // ms ); }
  18. Here are two use cases. Right-clicking on a wooden door and a chest. They both fire a RightClickBlock event. I can use the event to get the block, the block state, iterate the properties to see if it's open. That works for the door because there's an "open" property. Player right click block: minecraft:wooden_door[facing=south,half=upper,hinge=left,open=false,powered=false] class net.minecraft.block.state.BlockStateContainer$StateImplementation Block state: false Opened Door I don't see an open property for the chest. Player right click block: minecraft:chest[facing=east] class net.minecraft.block.state.BlockStateContainer$StateImplementation The chest open property must be in another castle... case "RightClickBlock": // net.minecraftforge.event.entity.player.PlayerInteractEvent$RightClickBlock { RightClickBlock gameEvent = (RightClickBlock) event; BlockPos pos = gameEvent.getPos(); IBlockState blockState = gameEvent.getWorld().getBlockState(pos); if (null != blockState) { System.out.println("Player right click block: " + blockState + " " + blockState.getClass()); StateImplementation state = (StateImplementation) blockState; Block block = state.getBlock(); switch (block.getRegistryName().toString()) { case "minecraft:wooden_door": for (IProperty<?> p : state.getPropertyKeys()) { if (p.getName().equals("open")) { System.out.println("Block state: " + state.getValue(p)); if ((boolean) state.getValue(p)) { System.out.println("Closed Door"); } else { System.out.println("Opened Door"); } break; } } break; default: System.out.println("Block name: " + block.getRegistryName()); break; } } } break;
  19. Top down or bottom up. Sure you can just look at the code and use the object inspector. I'd rather just play the game, do something, see what's logged, and hook into it that way. I don't play enough MC to auto recognize what the events are supposed to do.
  20. Oh looks like "Client thread" is returned when checking the thread name. That works. String threadName = Thread.currentThread().getName(); switch (threadName) { case "Server thread": return; } I can just return if it's a server event.
  21. Right I'll just play and watch the logs to get the events I'm looking for. Once I've identified an event that I'm interested, I'll just subscribe to that event in the final MOD. case "PlayerTickEvent": // net.minecraftforge.fml.common.gameevent.TickEvent$PlayerTickEvent PlayerTickEvent tickEvent = (PlayerTickEvent) event; if (tickEvent.player.isInWater() && !mPlayerState.mInWater) { mPlayerState.mInWater = true; System.out.println("Player is in Water"); } if (!tickEvent.player.isInWater() && mPlayerState.mInWater) { mPlayerState.mInWater = false; System.out.println("Player is not in Water"); } if (tickEvent.player.onGround && !mPlayerState.mOnGround) { mPlayerState.mOnGround = true; System.out.println("Player is on ground"); } if (!tickEvent.player.onGround && mPlayerState.mOnGround) { mPlayerState.mOnGround = false; System.out.println("Player is not on the ground"); } if (tickEvent.player.isAirBorne && !mPlayerState.mInAir) { mPlayerState.mInAir = true; System.out.println("Player is in the air"); } if (!tickEvent.player.isAirBorne && mPlayerState.mInAir) { mPlayerState.mInAir = false; System.out.println("Player is not in the air"); } if (tickEvent.player.isDead && mPlayerState.mAlive) { mPlayerState.mAlive = false; System.out.println("Player is Dead"); } if (!tickEvent.player.isDead && !mPlayerState.mAlive) { mPlayerState.mAlive = true; System.out.println("Player is Alive"); } if (tickEvent.player.isInLava() && !mPlayerState.mInLava) { mPlayerState.mInLava = true; System.out.println("Player is in Lava"); } if (!tickEvent.player.isInLava() && mPlayerState.mInLava) { mPlayerState.mInLava = false; System.out.println("Player is not in Lava"); } break; I see there's server and client events. [13:21:07] [Client thread/INFO]: [STDOUT]: Player is not on the ground [13:21:07] [Server thread/INFO]: [STDOUT]: Player is on the ground JUMPED [13:21:07] [Client thread/INFO]: [STDOUT]: Player is not on the ground [13:21:07] [Client thread/INFO]: [STDOUT]: Player is on the ground JUMPED Is there a condition I can check so that I'm only doing things on the client?
  22. Subscribing to the base class is just a means to get all the possible events and log that. Once everything is captured, sure only subscribe to explicit class types. And switched from Hashtable to List<String> for the quick capture... package occmod; import java.util.ArrayList; import java.util.List; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class MyForgeEventHandler { List<String> mEvents = new ArrayList<String>(); public void init() { MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void pickupItem(Event event) { switch (event.getClass().getSimpleName()) { case "AchievementEvent": // net.minecraftforge.event.entity.player.AchievementEvent case "AllowDespawn": // net.minecraftforge.event.entity.living.LivingSpawnEvent$AllowDespawn case "AttachCapabilitiesEvent": // net.minecraftforge.event.AttachCapabilitiesEvent case "AttackEntityEvent": // class net.minecraftforge.event.entity.player.AttackEntityEvent case "BackgroundDrawnEvent": // net.minecraftforge.client.event.GuiScreenEvent$BackgroundDrawnEvent case "BreakEvent": // net.minecraftforge.event.world.BlockEvent$BreakEvent case "BreakSpeed": // class net.minecraftforge.event.entity.player.PlayerEvent$BreakSpeed case "CameraSetup": // net.minecraftforge.client.event.EntityViewRenderEvent$CameraSetup case "CanUpdate": // net.minecraftforge.event.entity.EntityEvent$CanUpdate case "Chat": // net.minecraftforge.client.event.RenderGameOverlayEvent$Chat case "CheckSpawn": // net.minecraftforge.event.entity.living.LivingSpawnEvent$CheckSpawn case "ClientChatEvent": // class net.minecraftforge.client.event.ClientChatEvent case "ClientChatReceivedEvent": // net.minecraftforge.client.event.ClientChatReceivedEvent case "ClientConnectedToServerEvent": // net.minecraftforge.fml.common.network.FMLNetworkEvent$ClientConnectedToServerEvent case "ClientTickEvent": // net.minecraftforge.fml.common.gameevent.TickEvent$ClientTickEvent case "Close": // net.minecraftforge.event.entity.player.PlayerContainerEvent$Close case "CommandEvent": // class net.minecraftforge.event.CommandEvent case "CreateFluidSourceEvent": // class net.minecraftforge.event.world.BlockEvent$CreateFluidSourceEvent case "CustomPacketRegistrationEvent": // net.minecraftforge.fml.common.network.FMLNetworkEvent$CustomPacketRegistrationEvent case "Detonate": // net.minecraftforge.event.world.ExplosionEvent$Detonate case "DifficultyChangeEvent": // net.minecraftforge.event.DifficultyChangeEvent case "DrawBlockHighlightEvent": // net.minecraftforge.client.event.DrawBlockHighlightEvent case "EnteringChunk": // net.minecraftforge.event.entity.EntityEvent$EnteringChunk case "Entity": // net.minecraftforge.event.AttachCapabilitiesEvent$Entity case "EntityConstructing": // net.minecraftforge.event.entity.EntityEvent$EntityConstructing case "EntityItemPickupEvent": // class net.minecraftforge.event.entity.player.EntityItemPickupEvent case "EntityJoinWorldEvent": // net.minecraftforge.event.entity.EntityJoinWorldEvent case "FogColors": // net.minecraftforge.client.event.EntityViewRenderEvent$FogColors case "FogDensity": // net.minecraftforge.client.event.EntityViewRenderEvent$FogDensity case "FOVModifier": // net.minecraftforge.client.event.EntityViewRenderEvent$FOVModifier case "FOVUpdateEvent": // net.minecraftforge.client.event.FOVUpdateEvent case "GetCollisionBoxesEvent": // net.minecraftforge.event.world.GetCollisionBoxesEvent case "GetFoliageColor": // net.minecraftforge.event.terraingen.BiomeEvent$GetFoliageColor case "GetGrassColor": // net.minecraftforge.event.terraingen.BiomeEvent$GetGrassColor case "GetWaterColor": // net.minecraftforge.event.terraingen.BiomeEvent$GetWaterColor case "GuiOpenEvent": // net.minecraftforge.client.event.GuiOpenEvent case "HarvestCheck": // class net.minecraftforge.event.entity.player.PlayerEvent$HarvestCheck case "HarvestDropsEvent": // net.minecraftforge.event.world.BlockEvent$HarvestDropsEvent case "Item": // net.minecraftforge.event.AttachCapabilitiesEvent$Item case "ItemCraftedEvent": // class net.minecraftforge.fml.common.gameevent.PlayerEvent$ItemCraftedEvent case "ItemExpireEvent": // net.minecraftforge.event.entity.item.ItemExpireEvent case "ItemPickupEvent": // class net.minecraftforge.fml.common.gameevent.PlayerEvent$ItemPickupEvent case "ItemTooltipEvent": // net.minecraftforge.event.entity.player.ItemTooltipEvent case "ItemTossEvent": // class net.minecraftforge.event.entity.item.ItemTossEvent case "KeyInputEvent": // net.minecraftforge.fml.common.gameevent.InputEvent$KeyInputEvent case "LeftClickBlock": // net.minecraftforge.event.entity.player.PlayerInteractEvent$LeftClickBlock case "LeftClickEmpty": // net.minecraftforge.event.entity.player.PlayerInteractEvent$LeftClickEmpty case "LivingAttackEvent": // net.minecraftforge.event.entity.living.LivingAttackEvent case "LivingDeathEvent": // net.minecraftforge.event.entity.living.LivingDeathEvent case "LivingDropsEvent": // net.minecraftforge.event.entity.living.LivingDropsEvent case "LivingEquipmentChangeEvent": // net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent case "LivingExperienceDropEvent": // class net.minecraftforge.event.entity.living.LivingExperienceDropEvent case "LivingFallEvent": // net.minecraftforge.event.entity.living.LivingFallEvent case "LivingHurtEvent": // net.minecraftforge.event.entity.living.LivingHurtEvent case "LivingJumpEvent": // net.minecraftforge.event.entity.living.LivingEvent$LivingJumpEvent case "LivingPackSizeEvent": // net.minecraftforge.event.entity.living.LivingPackSizeEvent case "LivingSetAttackTargetEvent": // class net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent case "LivingUpdateEvent": // net.minecraftforge.event.entity.living.LivingEvent$LivingUpdateEvent case "Load": // class net.minecraftforge.event.world.WorldEvent$Load case "LoadFromFile": // net.minecraftforge.event.entity.player.PlayerEvent$LoadFromFile case "LootingLevelEvent": // net.minecraftforge.event.entity.living.LootingLevelEvent case "LootTableLoadEvent": // net.minecraftforge.event.LootTableLoadEvent case "ModelBakeEvent": // net.minecraftforge.client.event.ModelBakeEvent case "MouseEvent": // net.minecraftforge.client.event.MouseEvent case "MouseInputEvent": // net.minecraftforge.fml.common.gameevent.InputEvent$MouseInputEvent case "NameFormat": // net.minecraftforge.event.entity.player.PlayerEvent$NameFormat case "NeighborNotifyEvent": // net.minecraftforge.event.world.BlockEvent$NeighborNotifyEvent case "Open": // class net.minecraftforge.event.entity.player.PlayerContainerEvent$Open case "PlaceEvent": // net.minecraftforge.event.world.BlockEvent$PlaceEvent case "PlayerDestroyItemEvent": // class net.minecraftforge.event.entity.player.PlayerDestroyItemEvent case "PlayerFlyableFallEvent": // net.minecraftforge.event.entity.player.PlayerFlyableFallEvent case "PlayerLoggedInEvent": // net.minecraftforge.fml.common.gameevent.PlayerEvent$PlayerLoggedInEvent case "PlayerPickupXpEvent": // class net.minecraftforge.event.entity.player.PlayerPickupXpEvent case "PlayerSetSpawnEvent": // net.minecraftforge.event.entity.player.PlayerSetSpawnEvent case "PlayerTickEvent": // net.minecraftforge.fml.common.gameevent.TickEvent$PlayerTickEvent case "PlaySoundAtEntityEvent": // net.minecraftforge.event.entity.PlaySoundAtEntityEvent case "PlaySoundEvent": // net.minecraftforge.client.event.sound.PlaySoundEvent case "PlaySoundSourceEvent": // net.minecraftforge.client.event.sound.PlaySoundSourceEvent case "PlayStreamingSourceEvent": // net.minecraftforge.client.event.sound.PlayStreamingSourceEvent case "Post": // net.minecraftforge.client.event.TextureStitchEvent$Post case "PostBackground": // net.minecraftforge.client.event.RenderTooltipEvent$PostBackground case "PostText": // net.minecraftforge.client.event.RenderTooltipEvent$PostText case "PotentialSpawns": // net.minecraftforge.event.world.WorldEvent$PotentialSpawns case "Pre": // net.minecraftforge.client.event.TextureStitchEvent$Pre case "RenderBlockOverlayEvent": // class net.minecraftforge.client.event.RenderBlockOverlayEvent case "RenderFogEvent": // net.minecraftforge.client.event.EntityViewRenderEvent$RenderFogEvent case "RenderHandEvent": // net.minecraftforge.client.event.RenderHandEvent case "RenderSpecificHandEvent": // net.minecraftforge.client.event.RenderSpecificHandEvent case "RenderTickEvent": // net.minecraftforge.fml.common.gameevent.TickEvent$RenderTickEvent case "RenderWorldLastEvent": // net.minecraftforge.client.event.RenderWorldLastEvent case "ReplaceBiomeBlocks": // net.minecraftforge.event.terraingen.ChunkGeneratorEvent$ReplaceBiomeBlocks case "RightClickBlock": // net.minecraftforge.event.entity.player.PlayerInteractEvent$RightClickBlock case "RightClickEmpty": // net.minecraftforge.event.entity.player.PlayerInteractEvent$RightClickEmpty case "RightClickItem": // net.minecraftforge.event.entity.player.PlayerInteractEvent$RightClickItem case "Save": // net.minecraftforge.event.world.ChunkDataEvent$Save case "SaveToFile": // net.minecraftforge.event.entity.player.PlayerEvent$SaveToFile case "ServerConnectionFromClientEvent": // net.minecraftforge.fml.common.network.FMLNetworkEvent$ServerConnectionFromClientEvent case "ServerTickEvent": // net.minecraftforge.fml.common.gameevent.TickEvent$ServerTickEvent case "SoundLoadEvent": // net.minecraftforge.client.event.sound.SoundLoadEvent case "SpecialSpawn": // net.minecraftforge.event.entity.living.LivingSpawnEvent$SpecialSpawn case "Start": // net.minecraftforge.event.world.ExplosionEvent$Start case "StartTracking": // net.minecraftforge.event.entity.player.PlayerEvent$StartTracking case "StopTracking": // net.minecraftforge.event.entity.player.PlayerEvent$StopTracking case "Text": // net.minecraftforge.client.event.RenderGameOverlayEvent$Text case "TileEntity": // net.minecraftforge.event.AttachCapabilitiesEvent$TileEntity case "Unload": // net.minecraftforge.event.world.ChunkEvent$Unload case "UnWatch": // net.minecraftforge.event.world.ChunkWatchEvent$UnWatch case "Watch": // net.minecraftforge.event.world.ChunkWatchEvent$Watch case "World": // net.minecraftforge.event.AttachCapabilitiesEvent$World case "WorldTickEvent": // net.minecraftforge.fml.common.gameevent.TickEvent$WorldTickEvent return; } String className = event.getClass().getSimpleName(); if (!mEvents.contains(className)) { mEvents.add(className); System.out.println("case \"" + className + "\": // " + event.getClass()); } } }
  23. Found the package: https://github.com/MinecraftForge/EventBus/tree/master/src/main/java/net/minecraftforge/eventbus Docs: https://mcforge.readthedocs.io/en/latest/events/intro/
×
×
  • Create New...

Important Information

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