Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Everything posted by naturaGodhead

  1. Hi everyone, I'm using the following code to open an enderchest via an item. However it seems like the inventories aren't synced and it causes ghost items and other glitches. if(player.world.isRemote) { if(player.isSneaking() && Keyboard.isKeyDown(Keyboard.KEY_SPACE)){ EntityPlayer playerE = (EntityPlayer)player; InventoryEnderChest inventoryenderchest = playerE.getInventoryEnderChest(); if (inventoryenderchest != null) playerE.displayGUIChest(inventoryenderchest); } }
  2. package com.natura.minestuckarsenal; import java.util.Optional; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import com.natura.minestuckarsenal.item.ItemLaserWeapon; import com.natura.minestuckarsenal.item.MinestuckArsenalItems; import net.java.games.input.Mouse; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.settings.GameSettings; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.EntityInteract; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class ClientEventHandler { public static final ResourceLocation LASER_LOC = new ResourceLocation(MinestuckArsenal.MODID, "textures/effects/laserbeam.png"); public ClientEventHandler() { } @SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true) public void onRenderWorld(RenderWorldLastEvent e) { EntityPlayer player = Minecraft.getMinecraft().player; GameSettings gs = Minecraft.getMinecraft().gameSettings; if(player.getActiveItemStack().getItem() == MinestuckArsenalItems.ahabsCrosshairs && gs.keyBindUseItem.isKeyDown()) { doRenderBeam(player); } } public static void doRenderBeam(EntityLivingBase shooter) { GlStateManager.depthMask(false); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE); GlStateManager.pushMatrix(); EntityPlayer player = Minecraft.getMinecraft().player; float partialTicks = Minecraft.getMinecraft().getRenderPartialTicks(); double doubleX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; double doubleY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; double doubleZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; Vec3d vec = new Vec3d(doubleX, doubleY+player.getEyeHeight(), doubleZ); Vec3d vec0 = shooter.getPositionVector().addVector(0, shooter.getEyeHeight()+0.2, 0); Vec3d vec1 = vec0; vec1 = Optional.ofNullable(ItemLaserWeapon.raytraceEntityPlayerLook(player, ItemLaserWeapon.range)) .map(rtr -> rtr.hitVec) .orElse(vec1); GlStateManager.translate(-doubleX, -doubleY, -doubleZ); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); Minecraft.getMinecraft().renderEngine.bindTexture(LASER_LOC); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR); drawBeam(vec0, vec1, vec, 0.13f); tessellator.draw(); GlStateManager.popMatrix(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); } public static void drawBeam(Vec3d S, Vec3d E, Vec3d P, float width) { Vec3d PS = S.subtract(P); Vec3d SE = E.subtract(S); Vec3d normal = PS.crossProduct(SE).normalize(); Vec3d half = normal.scale(width); Vec3d p1 = S.add(half); Vec3d p2 = S.subtract(half); Vec3d p3 = E.add(half); Vec3d p4 = E.subtract(half); drawQuad(Tessellator.getInstance(), p1, p3, p4, p2); } private static void drawQuad(Tessellator tessellator, Vec3d p1, Vec3d p2, Vec3d p3, Vec3d p4) { int brightness = 240; int b1 = brightness >> 16 & 65535; int b2 = brightness & 65535; BufferBuilder buffer = tessellator.getBuffer(); buffer.pos(p1.x, p1.y, p1.z).tex(0.0D, 0.0D).lightmap(b1, b2).color(255, 255, 255, 128) .endVertex(); buffer.pos(p2.x, p2.y, p2.z).tex(1.0D, 0.0D).lightmap(b1, b2).color(255, 255, 255, 128) .endVertex(); buffer.pos(p3.x, p3.y, p3.z).tex(1.0D, 1.0D).lightmap(b1, b2).color(255, 255, 255, 128) .endVertex(); buffer.pos(p4.x, p4.y, p4.z).tex(0.0D, 1.0D).lightmap(b1, b2).color(255, 255, 255, 128) .endVertex(); } } This is my rendering code right now, but this never seems to do anything? I have the event handler registered in my main class.
  3. To clarify, I'm just wanting to draw a "laser" where the player is looking when they use the item
  4. Hey just wondering what the right place to have rendering code for an item's use would be? Is there an event that would be best?
  5. I've added some very simple guns for my mod and want to set a fire rate for them if you're holding down the right mouse button. What would be the best way to do this? I don't want it to happen if you're just clicking once over and over, but only when holding the button down. I tried setting a simple counter but that still happens while single clicking and feels bad to not fire every few clicks. Relevant method: @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack itemstack = playerIn.getHeldItem(handIn); if (!playerIn.capabilities.isCreativeMode) { itemstack.damageItem(1, playerIn); } if (!worldIn.isRemote) { EntityBullet entityBullet = new EntityBullet(worldIn, playerIn, projectileDamage); entityBullet.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, speed, 0.1F); worldIn.spawnEntity(entityBullet); } return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack); }
  6. This is 1.12.2 for reference. The method was changed to public in the main mod a few hours ago and I updated.
  7. So I'm working on a feature for my mod. I reference another mod that I'm dependent on in an event handler. I use a method shown below, and while in my IDE the method shows no errors. When I try to build my mod through command prompt with gradlew build, I get an error saying that the the method is not visible. I've tried cleaning my workspace, deleting and replacing the dependant mod jar, and restarting my computer. The error: error: getPlayerList() is not public in Session; cannot be accessed from outside package. Where I reference the method: Method in question:
  8. So I posted the topic a few hours ago about having issues with an addon mod and its item registry replacing items with the same registry name in the other mod. I tried forcing my addon to run before the main mod, which caused the blocks to also get registered using the addon mod's modid. I think this means that the main mod is registering its items AFTER my addon mod, despite my mod being required-after. Is there a way to see if the other mod has already ran its ModItems.class, and then only start running mine once that has finished?
  9. Picture for reference. These items should be minestuck:<item> instead of minestuckarsenal:<item>. What's strange is the items that I manually registered with a minestuck registry name for replacing the originals work just fine and have a minestuck modid.
  10. Bump. It's really confusing me. It's broken all of the models from the main mod's items as they now are looking in minestuckarsenal instead of minestuck. Why are these things changing when I don't interact with them at all?
  11. So a bit of background, I've been making an addon mod for Minestuck for around a year now. I have a system of "replacing" items from the main mod by registering new items with the same registry name. It's worked for all intents and purposes until a recent update where the main mod switched the order of registering blocks and items. For some reason, this broke all of my replacement items. I tried to fix them by registering them with the main mod's modid. That fixed the crashing, but now all the items from the main mod are registered under the addon's mod's modid? Despite only four of them being "replacements". This is causing a lot of headache for me. Any advice would be a big help. I'm not really that good with coding and it takes me a bit to see obvious stuff Main mod's github: https://github.com/mraof/Minestuck/ My items class where everything is instantiated and registered.
  12. Turns out the issue was that I had an upper case letter in the name of the property. Changed that and set the default state with this.setDefaultState(this.getStateFromMeta(0)); and it seems to have worked.
  13. So I'm trying to have a boolean property that just does a simple "Glow at night" effect on this block. I've done something similar on a block in another mod, and as far as I can tell there's nothing different about them. Stopping at the super(material) in the debugger tells me the blockstate and default states are null, but why? Here's the relevant files. Lunarworks.java: ModBlocks: BlockSilverOre: Crash Report: Just a little insight would be helpful because I'm missing something obvious.
  14. When I try to use the same rendering code for the background for another mob it won't render either.
  15. Screenshots with an without the background piece.
  16. So I'm rendering a health bar that involves two parts, one overlapping the other. I was able to render the background bit perfectly fine, but when I try to render the actual bar that needs to move, it doesn't show up. I tried removing the background and still nothing shows up. Hoping someone can spot a simple mistake. https://github.com/linkisheroic/Minestuck/blob/1.12/src/com/mraof/minestuck/event/ClientEventHandler.java Rendering code
  17. It seems like it isn't fast enough to detect them before they get setDead()'d. Sometimes it catches them but not usually.
  18. I'm working on an addon mod for another mod, so I can't change the methods in the entity I'm trying to check collision for. When the player collides with the entity they "pick it up" like an item but it's just a game abstraction meant to change numbers associated with the player, so it isn't a living entity or item entity. I want to be able to play a custom sound when the player collects this entity, but I don't see a forge event for checking basic entity collisions? Can someone point towards something that might help me figure this out?
  19. So I've been working with the devs and we've narrowed it down to the crash only happening while you unlock any recipe in the mod's custom dimension. I'm assuming it has something to do with the playermp being null in this dimension for an unknown reason, and they seem as clueless as I am. Code below: https://github.com/mraof/Minestuck/tree/1.12
  20. So I've been having this issue frequently and I'm not sure what's causing it. Sometimes it happens when I close out of a GUI, and sometimes it happens when I collide with water. Only those two things cause this crash. Crash log below: https://pastebin.com/Yy1Swng1 Seems to be related to the RecipeBookServer? But what does that have to do with water?
  21. Alright I fixed that error, but now my items aren't registered in the game for some reason. Even though I subscribe to the registry event and register them in my items class, which gets handled in the main class.
  22. As before here is my code: https://github.com/linkisheroic/minestuckarsenal The crash is as follows: https://pastebin.com/CELREyNY The way that I'm doing it now is a bit different than I'm used to, so I wouldn't be completely surprised if I've made a novice mistake with resource locations.
  23. I am in contact with the devs. What exactly would have to change for this to work? Their mod works fine on its own.
  24. Yes. As I said, that's the main mod I'm using as an API. It seems like an obfuscation error when the game loads, but I can't figure out why.
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.