Jump to content

Romejanic

Forge Modder
  • Posts

    71
  • Joined

  • Last visited

Everything posted by Romejanic

  1. Thanks for the responses guys! I think i'll pick a newer version to work with. It might not have as big a player-base but it sounds like the API will be a lot better to work with and it'll be easier to keep it up to date rather than stagnating on 1.12. Thanks again!
  2. Hello all! It's been a while since I posted (5 years in fact!), and I'm looking at trying to get back into modding. Considering that a lot has changed since I stopped modding a lot, and it's a little hard to pick a Forge version to work with, I just wanted to ask from a developer standpoint what is the best Minecraft version to make mods for in 2020? The main factors I'm looking at is stability, ease of development, player base, etc. Thanks so much!
  3. Well, now that you've spawned the entity, you need to tell it what to look like (how to render). So, you need to make a class which extends Render, and bind it to your entity with: RenderingRegistry.registerEntityRenderingHandler(EntityFlame.class, new RenderEntityFlame()); Hope this helps! - Romejanic
  4. Basically, here's what you have to do: [*] Click on the little arrow next to the play button [*]Click on Run Configurations [*]Click on Client, and then click on Arguments [*]Under the program arguments section, type two things: 1) -username [insert your Mojang account email address] 2) -password [insert your Mojang account password] [*]Run the game, it should log into your account This will completely log you into your Mojang account. When you run the game, it will generate session IDs, authenticate you, etc. This means that you will have your username, the game will load your skin and you can even join online multiplayer servers without needing to crack them. Keep in mind that I've noticed this can increase the time it takes to start the game up, and I've noticed the game tends to crash when it can't connect to the server or you have no internet connection. Hope this helps! - Romejanic
  5. Hey. I'm trying to create a custom death message for the guns I'm adding to my mod. It will print a message like Bob was shot by Bill using AK12 And I'm using the func_151519_b(EntityLivingBase) function in the DamageSource class to create my death message. However, whenever I test it on a server, it does not translate or format the string at all, and just prints: death.attack.aw.bullet Does anyone know what's happening? Do I need to use vanilla code rather than making a custom death source? Here's my DamageSource class: package assets.aw.common.utils; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraft.util.IChatComponent; import net.minecraft.util.StatCollector; public class DamageSourceBullet extends EntityDamageSourceIndirect { private String gun = "item.aw.gun.unknown"; public DamageSourceBullet(Entity attacker, Entity attackee, String gun) { super("death.attack.aw.bullet", attacker, attackee); this.gun = gun; } public IChatComponent func_151519_b(EntityLivingBase p_151519_1_) { String attackerName = this.getSourceOfDamage().getCommandSenderName(); String attackeeName = this.getEntity().getCommandSenderName(); String gunName = StatCollector.translateToLocal(gun); return new ChatComponentTranslation("death.attack.aw.bullet", attackeeName, attackerName, gunName); } } Thanks, Romejanic
  6. if(event.isCancelable() || event.type != ElementType.EXPERIENCE) { You're cancelling the method if the event is cancellable. The event is ALWAYS cancellable. What you're probably looking for is event.isCanceled() or something along those lines.
  7. Basically delete the Shape5.mirror = true; line, and it should work. It's pretty much trying to define a boolean on a null variable.
  8. I know. I send a packet from the client to be processed on the server. It works perfectly on multiplayer, but singleplayer doesn't work at all.
  9. Ahh, here's the problem: if(!world.isRemote) { return; } I've changed it to world.isRemote and fixed up my packets a bit. But now, the attacks work in multiplayer fine, but world.isRemote is ALWAYS true on singleplayer. It even tells me that it registered the event on the server, but the doGroundSlam runs on the client!
  10. It looks like either there are too many sounds for the sound handler to process, or some sounds are being registered or modified while the game is trying to play them. Might be a problem with Minecraft, and not your mod.
  11. Hey guys, I am trying to make ground slams, which attack all entities within a certain radius. It's all working good, except the actual entity attacks aren't working. I keep trying different things, even using vanilla Damage Sources, but it's still not working. Ground Slam Code: private void doGroundSlam(EntityPlayer player, World world) { if(!world.isRemote) { return; } double groundSlamRadius = 5; double startX = player.posX - groundSlamRadius; double startY = player.posY - groundSlamRadius; double startZ = player.posZ - groundSlamRadius; double endX = player.posX + groundSlamRadius; double endY = player.posY + groundSlamRadius; double endZ = player.posZ + groundSlamRadius; for(Object obj : world.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.getBoundingBox(startX, startY, startZ, endX, endY, endZ))) { Entity entity = (Entity)obj; double distance = entity.getDistanceToEntity(player); if(entity instanceof EntityLivingBase) { ((EntityLivingBase) entity).attackEntityAsMob(player); } entity.attackEntityFrom(new DamageSourceGroundSlam(entity, player), (float)distance / 20f); } } DamageSource code: package assets.aw.common.utils; import net.minecraft.entity.Entity; import net.minecraft.util.EntityDamageSourceIndirect; public class DamageSourceGroundSlam extends EntityDamageSourceIndirect { public DamageSourceGroundSlam(Entity p_i1568_2_, Entity p_i1568_3_) { super("aw.slam", p_i1568_2_, p_i1568_3_); this.setDamageBypassesArmor(); } } Anyone got any ideas? - Romejanic
  12. Can I ask why you are making your own class extending KeyBinding? Why not just use new KeyBinding(name, key, category)?
  13. Since you've put the @SideOnly annotation on the method, it is not included as part of the class on the server. It will crash if you try to call it. Try replacing your particle code with this: public void onLivingUpdate() { super.onLivingUpdate(); if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) spawnParticle(); for(int l = 0; l <= 4; ++l) //TODO { if(worldObj.rand.nextFloat() < footprint_chance) { continue; } if(Constants.DEF_GRASSSTEP == true){ int x = MathHelper.floor_double(this.posX + (l % 2 * 2 - 1) * 0.25F); int y = MathHelper.floor_double(this.posY) - 1 ; int z = MathHelper.floor_double(this.posZ + (l / 2 % 2 * 2 - 1) * 0.25F); BlockPos pos = new BlockPos(x, y, z); IBlockState state = this.worldObj.getBlockState(pos); boolean isAnyDirt = state.getBlock() == Blocks.dirt; boolean isRegularDirt = isAnyDirt && state.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT; if (isAnyDirt && isRegularDirt){ //TODO this.worldObj.setBlockState(pos, footprint.getDefaultState()); } } } if (isServer() && this.isWet && !this.isShaking && !this.hasPath() && this.onGround) { this.isShaking = true; this.timeWolfIsShaking = 0.0F; this.prevTimeWolfIsShaking = 0.0F; this.worldObj.setEntityState(this, (byte); } if (isServer() && this.getAttackTarget() == null && this.isAngry()) { this.setAngry(false); } if(Constants.DEF_HEALING == true && !this.isChild() && this.getHealth() <=10 && this.isTamed()) { this.addPotionEffect(new PotionEffect(10, 200)); } if (this.getAttackTarget() == null && isTamed() && 15 > 0) { List list1 = worldObj.getEntitiesWithinAABB(EntityCreeper.class, AxisAlignedBB.fromBounds(posX, posY, posZ, posX + 1.0D, posY + 1.0D, posZ + 1.0D).expand(sniffRange(), 4D, sniffRange())); if (!list1.isEmpty() && !isSitting() && this.getHealth() > 1 && !this.isChild()) { canSeeCreeper = true; } else { canSeeCreeper = false; } } }
  14. I just want to be able to render a full 3D block on my GUI. I would prefer to use RenderBlocks instead of RenderItem.
  15. Sometimes, the rotation point of models aren't always accurate. If you rotate an object and it hovers in mid-air, you may need to translate it back into position. Could you post a screenshot showing what's happening?
  16. You either have to use glScale (which screws up the position) or make a custom FontRenderer. You coudl also try forcing Unicode font.
  17. Something being passed to ModelBakery.addVariantName is null. Review your registry code and see if you can anything that hasn't been initialized yet.
  18. Thanks now it works. In my hand i see the smaller cube inside the bigger, but when i place it it's not transparent anymore and still fly in the air instead of standing You need to use GL11.glTranslate in your render class to move it into the right place. Example: GL11.glTranslatef(1f, 1f, 0f); Run the game in Debug mode (if you have eclipse) and keep experimenting with it. It might take a while for it to work properly.
  19. Just a little tip, you should move the spawning code out of your entity and into your Common Proxy and Client Proxy. CommonProxy: public void spawnParticleRing(){} ClientProxy: public void spawnParticleRing() { yaw += yawVelocity; if (yaw > 2*Math.PI) yaw -= 2*Math.PI; if (Math.random() < 0.1) { pitchVelocity = 0.2f; } pitch += pitchVelocity; if (pitch > maxPitch) pitch = maxPitch; if (pitchVelocity > 0) { pitchVelocity -= 0.05f; } else { pitchVelocity = 0; } if (pitch > 0) { pitch -= 0.07f; } else { pitch = 0; } EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer; VisualEffectTornado ring = new VisualEffectTornado(worldObj, posX, posY + 0.1D, posZ, motionX, motionY, motionZ, yaw, pitch, 0.7f, effectRenderer); effectRenderer.addEffect(ring); ring.setDead(); // I suspect I have to destroy the ring somehow but im stuck as to how to do it } In onUpdate(): public void onUpdate() { super.onUpdate(); motionY += 0.01D; YourMod.proxy.spawnParticleRing(); if (!worldObj.isRemote) { attackNearbyEntities(); if (ticksExisted > 40) { setDead(); releaseDrops(); } else if (ticksExisted % AttackTypeRanged.AIR.getSoundFrequency() == (AttackTypeRanged.AIR.getSoundFrequency() - 1)) { worldObj.playSoundAtEntity(this, AttackTypeRanged.AIR.getMovingSound(), AttackTypeRanged.AIR.getSoundPitch(rand), AttackTypeRanged.AIR.getSoundVolume(rand)); } } }
  20. You need these two functions in your class: public Packet getDescriptionPacket() { NBTTagCompound tag = new NBTTagCompound(); writeToNBT(tag); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); } public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { readFromNBT(packet.func_148857_g()); } This will send data updates to the client when the chunk with the TE is loaded. It will work on singleplayer and multiplayer.
  21. Hey everyone, I am trying to render a block onto a GUI in 3D. I'm not using the ItemRenderer code, because the block has to be in full 3D. I am trying to render it, but it isn't working. It's not crashing the game or throwing errors, but it isn't rendering all the same. I need to work this out to finish the mod. Here's the render code: public void renderModel() { RenderBlocks blockRenderer = new RenderBlocks(Minecraft.getMinecraft().theWorld); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); for(BlockData data : getBlocks()) { GL11.glPushMatrix(); GL11.glScalef(data.getScaleX(), data.getScaleY(), data.getScaleZ()); GL11.glTranslatef(data.getPositionX(), data.getPositionY(), data.getPositionZ()); blockRenderer.renderBlockAllFaces(data.getBlock(), 0, 0, 0); GL11.glPopMatrix(); } } Here's the GUI code: package assets.blockmodeller.client.gui; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.resources.I18n; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.network.play.client.C01PacketChatMessage; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import assets.blockmodeller.client.model.BlockData; import assets.blockmodeller.client.model.Model; public class GuiBlockModeller extends GuiScreen { public Model model; public GuiBlockModeller() { model = new Model("New Model"); model.addBlock(Blocks.grass, 0); } public void initGui() { Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C01PacketChatMessage("/me " + I18n.format("mutliplayer.blockmodeller.guiOpened"))); } public void drawScreen(int mx, int my, float f) { drawDefaultBackground(); super.drawScreen(mx, my, f); renderModel(51, 75); } public void renderModel(int x, int y) { GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix(); GL11.glTranslatef((float)x, (float)y, 50.0F); //GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); model.renderModel(); GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); this.mc.renderEngine.bindTexture(Gui.icons); } private void drawItemStack(ItemStack p_146982_1_, int p_146982_2_, int p_146982_3_, String p_146982_4_) { GL11.glTranslatef(0.0F, 0.0F, 32.0F); this.zLevel = 200.0F; itemRender.zLevel = 200.0F; FontRenderer font = null; if (p_146982_1_ != null) font = p_146982_1_.getItem().getFontRenderer(p_146982_1_); if (font == null) font = fontRendererObj; itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_); itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_, p_146982_4_); this.zLevel = 0.0F; itemRender.zLevel = 0.0F; } public boolean doesGuiPauseGame() { return false; } } Can anyone help? It would really help me out, and please, not ItemRenderer! - Romejanic
  22. I'm making a messaging service, and the message identification is based on UUIDs to support name changes. It has zero involvement with the server, it's all on the client.
  23. Yeah, but my mod is client-side. I can't use the server. I guess I could make my own instance of the cache, but that might be a little dangerous. I'll try it anyway.
  24. Thanks for your response. The initial method didn't work, so I had to change it to this: public static String getName(String uuid) { String name = null; try { URL url = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); StringBuilder sb = new StringBuilder(); String line; while((line = reader.readLine()) != null) { sb.append(line + "\n"); } System.out.println(sb.toString()); JsonParser parser = new JsonParser(); JsonElement obj = parser.parse(sb.toString().trim()); name = obj.getAsJsonObject().get("name").getAsString(); reader.close(); } catch (Exception ex) { ex.printStackTrace(); name = ex.toString(); } return name; } It was saying that I couldn't convert the response to a Json object. I put the print in and the string returning from the server was empty. I pasted the URL in Chrome along with a UUID at the end, and nothing happened. The script doesn't return anything. I just need another source to get the json code
×
×
  • Create New...

Important Information

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