-
Posts
6157 -
Joined
-
Last visited
-
Days Won
59
Everything posted by Animefan8888
-
Minecraft [1.10.2] Cusome Menu Need Help
Animefan8888 replied to jackmaster9000's topic in Modder Support
Could you give us a little more information? What do you mean animate? How will the user interact with the UI? Will it be via the scroll wheel or arrow keys? Will they click to activate the action or press a button on the keyboard? -
You only ever save your upgrade slots if anything.
-
You never initialize network.
-
On line 64 in your MouseEventHandler class there is a null field.
-
Make it in code aka .java syntax.
-
Listen to eclipse it is probably an invalid arguement.
-
Ohh, you mean print to console? I just tested it now, apparently the init method on my CommonProxy doesn't load at all. How can I fix this? Obviously you need to call it from your main init method in your main mod class.
-
Show where you registered the block, and was there an error in the log?
-
1.10.2 How do i make Villagers use the Biped Human model?
Animefan8888 replied to sodaddict's topic in Modder Support
Look for where the model is "binded" to the entity Where? Either in the Entity or in the Renderer. -
Are there multiple MouseEvents? I will post all of the code that was changed from jabelar's tutorial to fit 1.10 in a bit. I'm not on the same computer that has it right now. MouseEvent should be donenin client proxy because the server doesnt need to know what do you have inside that method? Are you importing the correct MouseEvent? net.minecraftforge.client.event.MouseEvent is being imported. I moved it from CommonProxy to ClientProxy, still no difference. MouseEventHandler: package bloopers.spearmod.reach; import java.awt.List; import org.lwjgl.input.Mouse; import bloopers.spearmod.SpearMod; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraftforge.client.event.MouseEvent; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.Mod.EventHandler; 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 MouseEventHandler { @SideOnly(Side.CLIENT) @SubscribeEvent @EventHandler public void onEvent(MouseEvent event) { int button = event.getButton(); boolean buttonstate = event.isButtonstate(); if (button == 0 && buttonstate) { Minecraft mc = Minecraft.getMinecraft(); EntityPlayer thePlayer = mc.thePlayer; if (thePlayer != null) { ItemStack itemstack = thePlayer.getHeldItemMainhand(); IExtendedReach ieri; if (itemstack != null) { if (itemstack.getItem() instanceof IExtendedReach) { ieri = (IExtendedReach) itemstack.getItem(); } else { ieri = null; } if (ieri != null) { float reach = ieri.getReach(); RayTraceResult mov = getMouseOverExtended(reach); if (mov != null) { if (mov.entityHit != null && mov.entityHit.hurtResistantTime == 0) { if (mov.entityHit != thePlayer ) { SpearMod.network.sendToServer(new MessageExtendedReachAttack( mov.entityHit.getEntityId())); } } } } } } } } // This is mostly copied from the EntityRenderer#getMouseOver() method public static RayTraceResult getMouseOverExtended(float dist) { Minecraft mc = FMLClientHandler.instance().getClient(); Entity theRenderViewEntity = mc.getRenderViewEntity(); AxisAlignedBB theViewBoundingBox = new AxisAlignedBB( theRenderViewEntity.posX-0.5D, theRenderViewEntity.posY-0.0D, theRenderViewEntity.posZ-0.5D, theRenderViewEntity.posX+0.5D, theRenderViewEntity.posY+1.5D, theRenderViewEntity.posZ+0.5D ); RayTraceResult returnMOP = null; if (mc.theWorld != null) { double var2 = dist; returnMOP = theRenderViewEntity.rayTrace(var2, 0); double calcdist = var2; Vec3d pos = theRenderViewEntity.getPositionEyes(0); var2 = calcdist; if (returnMOP != null) { calcdist = returnMOP.hitVec.distanceTo(pos); } Vec3d lookvec = theRenderViewEntity.getLook(0); Vec3d var8 = pos.addVector(lookvec.xCoord * var2, lookvec.yCoord * var2, lookvec.zCoord * var2); Entity pointedEntity = null; float var9 = 1.0F; @SuppressWarnings("unchecked") java.util.List<Entity> list = mc.theWorld.getEntitiesWithinAABBExcludingEntity( theRenderViewEntity, theViewBoundingBox.addCoord( lookvec.xCoord * var2, lookvec.yCoord * var2, lookvec.zCoord * var2).expand(var9, var9, var9)); double d = calcdist; for (Entity entity : list) { if (entity.canBeCollidedWith()) { float bordersize = entity.getCollisionBorderSize(); AxisAlignedBB aabb = new AxisAlignedBB( entity.posX-entity.width/2, entity.posY, entity.posZ-entity.width/2, entity.posX+entity.width/2, entity.posY+entity.height, entity.posZ+entity.width/2); aabb.expand(bordersize, bordersize, bordersize); RayTraceResult mop0 = aabb.calculateIntercept(pos, var8); if (aabb.isVecInside(pos)) { if (0.0D < d || d == 0.0D) { pointedEntity = entity; d = 0.0D; } } else if (mop0 != null) { double d1 = pos.distanceTo(mop0.hitVec); if (d1 < d || d == 0.0D) { pointedEntity = entity; d = d1; } } } } if (pointedEntity != null && (d < calcdist || returnMOP == null)) { returnMOP = new RayTraceResult(pointedEntity); } } return returnMOP; } } MessageExtendedReachAttack: package bloopers.spearmod.reach; import bloopers.spearmod.SpearMod; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class MessageExtendedReachAttack implements IMessage { private int entityId ; public MessageExtendedReachAttack() { // need this constructor } public MessageExtendedReachAttack(int parEntityId) { entityId = parEntityId; // DEBUG System.out.println("Constructor"); } @Override public void fromBytes(ByteBuf buf) { entityId = ByteBufUtils.readVarInt(buf, 4); // DEBUG System.out.println("fromBytes"); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeVarInt(buf, entityId, 4); // DEBUG System.out.println("toBytes encoded"); } public static class Handler implements IMessageHandler<MessageExtendedReachAttack, IMessage> { @Override public IMessage onMessage(final MessageExtendedReachAttack message, MessageContext ctx) { // DEBUG System.out.println("Message received"); // Know it will be on the server so make it thread-safe final EntityPlayerMP thePlayer = (EntityPlayerMP) SpearMod.proxy. getPlayerEntityFromContext(ctx); thePlayer.getServer().addScheduledTask( new Runnable() { @Override public void run() { Entity theEntity = thePlayer.worldObj. getEntityByID(message.entityId); // DEBUG System.out.println("Entity = "+theEntity); // Need to ensure that hackers can't cause trick kills, // so double check weapon type and reach if (thePlayer.getHeldItemMainhand() == null) { return; } if (thePlayer.getHeldItemMainhand().getItem() instanceof IExtendedReach) { IExtendedReach theExtendedReachWeapon = (IExtendedReach)thePlayer.getHeldItemMainhand(). getItem(); double distanceSq = thePlayer.getDistanceSqToEntity( theEntity); double reachSq =theExtendedReachWeapon.getReach()* theExtendedReachWeapon.getReach(); if (reachSq >= distanceSq) { thePlayer.attackTargetEntityWithCurrentItem( theEntity); } } return; // no response in this case } } ); return null; // no response message } } } IExtendedReach: package bloopers.spearmod.reach; public interface IExtendedReach { public float getReach(); // default is 1.0D } And then in item classes to set the reach: @Override public float getReach() { return 15.0F; } At 15 for testing. What is button 0?
-
1.10.2 How do i make Villagers use the Biped Human model?
Animefan8888 replied to sodaddict's topic in Modder Support
Look for where the model is "binded" to the entity -
Are there multiple MouseEvents? I will post all of the code that was changed from jabelar's tutorial to fit 1.10 in a bit. I'm not on the same computer that has it right now. MouseEvent should be donenin client proxy because the server doesnt need to know what do you have inside that method? Are you importing the correct MouseEvent?
-
Yes. And inside it is everything the event should do. Do you know Java or was that a retorical question?
-
Put in a pull request on forges github, i do not know if they will accept it or not.
-
To be more specific createTileEntity(IBlockAccess world, IBlockState state) hasTileEntitity(IBlockState state) I noticed you have getBlockLayer(...) set to translucent, what are the other options there as i do not remember (no IDE or code ATM).
-
Is INSTANCE ever initialized?
-
Is this your class? com/schematica/client/renderer/RenderSchematic
-
Check when you initialize your helmet you are not even using your armor class. Also you didnt post the whole error log. Dont use the deprecated registerItem method. And why are you using getUnlocalizedName that is why you have a registryName GameRegistry.register(item); Not GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5);
-
Well is it not working? If so probably, but this is what i meant // Not this public static ItemAWArmor iridium_helmate; // This public static Item IRIDIUM_HELMET; // And yes that is how it is spelt.
-
The field ahould be of the type Item yes, but your class should extend ItemArmor.
-
Obviously take the functions not the methods exactly from those tools.
-
Item Items SoundEvent... plural
-
It is because you are creating a new SoundEvent like items they are singletons.