Jump to content

HappleAcks

Members
  • Posts

    124
  • Joined

  • Last visited

Posts posted by HappleAcks

  1. Hi,

     

    So I just noticed when testing out a new mob of mine, that the health is capped at 1024. When I enter this line:

    this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(2000F);

     

    If I put the number above 1024 it won't go higher (I tested with print-outs of the health) but it works at lesser values. In 1.7 the health like this was not capped, so is there something new in 1.8 I'm supposed to do to get around this because it seems obsurd that the health would be capped at such a low value now.

     

    This points to saying the max value is 1024 in the SharedMonsterAttribute class:

    (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)

     

    Whereas before it was set to Double.MAX_VALUE which is basically unreachable. I'm aware I can modify damage and whatnot to try to work around the 1024 but this is such a ridiculously low number (especially when damage is 2048) that I'm not sure what to do. Is there a workaround for this?

  2. Hi,

     

    So I've created a new mob that has visual dimensions of 5x17. I used the this.setSize(5F, 17F); in the main constructor. When I go in game and hit F3+B it shows the correct bounding box for the mob. However, when I actually try and hit the mob, it only has a bounding box of 5x5x6ish (so just only 6 blocks tall).

     

    I can also place blocks inside of the higher parts that appear in the bounding box shown at F3+B but not at the lower parts.

     

    What exactly is going on here?

  3. I see no question.

     

    Here is one for you: where is that "energy" stored ?

     

    So it's currently stored in NBT. My question is how would one go about implementing the packets so that it would work on servers. What I'm trying to do is make it check the energy on client side rather than client and server.

     

    Basically:

     

    If client has this value, server does this.

  4. Alright so I have a successful custom resource system called energy. A player can use items that consume it and everything works fine (it regens per tick and shows a GUI bar on the left) however it doesn't work on servers since it doesn't use packets.

     

    Currently to drain from the bar I just call the class file and a drain function like this:

     

    energystats.drain(25)

     

    which would drain 25 energy. The problem is on a server it isn't bound to a user I guess so I'm not sure how to implement the packets to fix this.

  5. This should fix it.

    First, you should try changing your block file code to

    "public static BlockDarklandPortal darklandPortal = new BLockDarklandPortal()"

    I have previously had trouble with methods in parenthesis before itself.

    Then, for your code:

    public BlockDarklandPortal() {
          super("darklandPortal", Material.portal, false);
          this.setTickRandomly(true);
          setBlockName("darklandPortal");
          setBlockTextureName( [YOURMODSCLASS].MODID + ":" +"textures/portals/darklandPortal.png");
          setCreativeTab(CreativeTabs.tabBlock);
          GameRegistry.registerBlock(this, "darklandPortal");
       }

    where [YOURMODSCLASS] would be replaced by whatever file contains your mod's mod ID (MODID).

    Note that I added .png to the end of your filename.

    Also, if you still have trouble but it is looking in the correct folder, make sure png is not capitalized  (PNG). I have learned the hard way that that will break the texture.

    I'm not able to access the modid for some reason, this is how I have it set in my main file:

    @Mod(modid = "darkmod" ....)

  6. So I have a custom portal block, everything but the texture is working. It keeps looking for the texture here:

    Using missing texture, unable to load minecraft:textures/blocks/darklandPortal.png

     

    In my blocks file:

    "public static final BlockDarklandPortal darklandPortal = (BlockDarklandPortal)new BlockDarklandPortal();"

     

    Inside my Portal Block Code:

     

     

    public BlockDarklandPortal() {

    super("darklandPortal", Material.portal, false);

    this.setTickRandomly(true);

    setBlockName("darklandPortal");

    setBlockTextureName("darkmod:/portals/darklandPortal");

    setCreativeTab(CreativeTabs.tabBlock);

    GameRegistry.registerBlock(this, "darklandPortal");

    }

     

     

  7. So whenever I start up the mod I get this line below. I don't have any packages outside of my main ones which are all in src/main/java/net/darkMod/___

     

     

     

    The line:

    [FML]: FML has detected a mod that is using a package name based on 'net.minecraft.src' : net.minecraft.src.FMLRenderAccessLibrary. This is generally a severe programming error.  There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into a new package. Go on. DO IT NOW!

  8. If you posted the full log, we could see where the error was happening - it is probably after the world has already finished generating, but the player is trying to join. Did you change or add any attributes for the player, such as in IExtendedEntityProperties?

    I haven't touched any of those player properties, I also went through all mobs [mine and Vanilla], none of them are an issue.

     

    I'll go back through my logs as soon as I get home in a couple hours and post the full thing.

     

    edit: I think I might know what is causing it. It seems one of my mobs was spawned in all the different occurrences, so I'm going to look into that.  The mob itself works fine, but it seems it might have Overriden the Horse ID [in spawn code, even though it's a registered mod entity].

  9. Alright, so I'm currently changing the sky color of a dimension I have. The sky will appear as a different color [neither the correct one] depending on which way you look. I've tried fiddling with both extensively, but I either just get bright blue or this duo-color.

     

    My sky color code in biome class:

        @Override

        @SideOnly(Side.CLIENT)

        public int getSkyColorByTemp(float par1) {

            return Color.YELLOW.getRGB();

        }

     

    In world provider class, the celestial angle:

    @Override

        public float calculateCelestialAngle(long var1, float var3) {

            return 0.25F;

        }

     

  10. java.lang.IllegalArgumentException: Default value cannot be lower than minimum value!
    

    That pretty much says it all right there; whatever ranged attribute you added / changed, you have either an invalid default value or you set the minimum value incorrectly. Ranged attributes are things like attackDamage, movementSpeed, maxHealth, etc.

    I see, I'm not sure what is causing it though considering it happens on world creation. I also don't have any mobs that should be spawning.

  11. So I got the error pasted below quite a bit lately [random when generating a world] and I don't know what causes it or how to fix it.

     

    The error:

     

     

    Unreported exception thrown!

    java.lang.IllegalArgumentException: Default value cannot be lower than minimum value!

    at net.minecraft.entity.ai.attributes.RangedAttribute.<init>(RangedAttribute.java:22) ~[RangedAttribute.class:?]

    at net.minecraft.client.network.NetHandlerPlayClient.handleEntityProperties(NetHandlerPlayClient.java:1834) ~[NetHandlerPlayClient.class:?]

    at net.minecraft.network.play.server.S20PacketEntityProperties.processPacket(S20PacketEntityProperties.java:96) ~[s20PacketEntityProperties.class:?]

    at net.minecraft.network.play.server.S20PacketEntityProperties.processPacket(S20PacketEntityProperties.java:104) ~[s20PacketEntityProperties.class:?]

    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242) ~[NetworkManager.class:?]

    at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:339) ~[PlayerControllerMP.class:?]

    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1689) ~[Minecraft.class:?]

    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1036) ~[Minecraft.class:?]

    at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]

    at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51]

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]

    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]

    at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

    ---- Minecraft Crash Report ----

    // Oh - I know what I did wrong!

     

    Time: 5/27/14 3:47 PM

    Description: Unexpected error

     

    java.lang.IllegalArgumentException: Default value cannot be lower than minimum value!

    at net.minecraft.entity.ai.attributes.RangedAttribute.<init>(RangedAttribute.java:22)

    at net.minecraft.client.network.NetHandlerPlayClient.handleEntityProperties(NetHandlerPlayClient.java:1834)

    at net.minecraft.network.play.server.S20PacketEntityProperties.processPacket(S20PacketEntityProperties.java:96)

    at net.minecraft.network.play.server.S20PacketEntityProperties.processPacket(S20PacketEntityProperties.java:104)

    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242)

    at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:339)

    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1689)

    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1036)

    at net.minecraft.client.Minecraft.run(Minecraft.java:951)

    at net.minecraft.client.main.Main.main(Main.java:112)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

     

     

    A detailed walkthrough of the error, its code path and all known details is as follows:

    ---------------------------------------------------------------------------------------

     

    -- Head --

    Stacktrace:

    at net.minecraft.entity.ai.attributes.RangedAttribute.<init>(RangedAttribute.java:22)

    at net.minecraft.client.network.NetHandlerPlayClient.handleEntityProperties(NetHandlerPlayClient.java:1834)

    at net.minecraft.network.play.server.S20PacketEntityProperties.processPacket(S20PacketEntityProperties.java:96)

    at net.minecraft.network.play.server.S20PacketEntityProperties.processPacket(S20PacketEntityProperties.java:104)

    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242)

    at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:339)

     

    -- Affected level --

    Details:

    Level name: MpServer

    All players: 1 total; [EntityClientPlayerMP['Player390'/110, l='MpServer', x=221.50, y=68.52, z=264.50]]

    Chunk stats: MultiplayerChunkCache: 85, 85

    Level seed: 0

    Level generator: ID 00 - default, ver 1. Features enabled: false

    Level generator options:

    Level spawn location: World: (228,64,256), Chunk: (at 4,4,0 in 14,16; contains blocks 224,0,256 to 239,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

    Level time: 22 game time, 22 day time

    Level dimension: 0

    Level storage version: 0x00000 - Unknown?

    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false

    Forced entities: 54 total; [EntityBat['Bat'/821, l='MpServer', x=178.07, y=16.41, z=208.85], EntityFallingBlock['Falling Block'/1102, l='MpServer', x=134.50, y=9.34, z=221.50], EntityZombie['Zombie'/1103, l='MpServer', x=143.50, y=28.00, z=202.50], EntityZombie['Zombie'/141, l='MpServer', x=158.78, y=37.00, z=238.50], EntityCreeper['Creeper'/142, l='MpServer', x=161.50, y=37.00, z=236.50], EntityCreeper['Creeper'/948, l='MpServer', x=168.50, y=30.00, z=230.50], EntityItem['item.tile.rail'/8, l='MpServer', x=166.88, y=32.13, z=225.72], EntityItem['item.tile.flower1.dandelion'/9, l='MpServer', x=184.84, y=11.05, z=231.41], EntityItem['item.tile.flower1.dandelion'/10, l='MpServer', x=186.31, y=11.13, z=230.13], EntityPig['Pig'/11, l='MpServer', x=217.78, y=68.00, z=197.91], EntityZombie['Zombie'/133, l='MpServer', x=187.50, y=24.00, z=207.50], EntityPig['Pig'/12, l='MpServer', x=220.50, y=67.00, z=196.50], EntityPig['Pig'/13, l='MpServer', x=216.03, y=68.00, z=199.81], EntityPig['Pig'/14, l='MpServer', x=217.66, y=68.00, z=199.81], EntityZombie['Zombie'/134, l='MpServer', x=183.50, y=24.00, z=210.50], EntityBushBaby['Bush Baby'/17, l='MpServer', x=223.22, y=67.00, z=185.47], EntityFallingBlock['Falling Block'/1117, l='MpServer', x=131.50, y=9.38, z=221.50], EntityFallingBlock['Falling Block'/1116, l='MpServer', x=134.50, y=9.38, z=220.50], EntityFallingBlock['Falling Block'/1119, l='MpServer', x=132.50, y=10.38, z=220.50], EntityFallingBlock['Falling Block'/1118, l='MpServer', x=132.50, y=8.38, z=222.50], EntityFallingBlock['Falling Block'/1113, l='MpServer', x=133.50, y=8.38, z=222.50], EntityFallingBlock['Falling Block'/1112, l='MpServer', x=132.50, y=9.38, z=221.50], EntityFallingBlock['Falling Block'/1115, l='MpServer', x=133.50, y=10.38, z=220.50], EntityFallingBlock['Falling Block'/1114, l='MpServer', x=133.50, y=9.38, z=221.50], EntityFallingBlock['Falling Block'/1111, l='MpServer', x=134.50, y=10.42, z=221.50], EntitySheep['Sheep'/34, l='MpServer', x=248.50, y=69.00, z=189.22], EntitySheep['Sheep'/35, l='MpServer', x=248.50, y=69.00, z=190.81], EntityPig['Pig'/38, l='MpServer', x=265.50, y=63.00, z=304.22], EntityPig['Pig'/39, l='MpServer', x=265.50, y=63.00, z=305.81], EntitySheep['Sheep'/36, l='MpServer', x=251.50, y=69.00, z=192.50], EntitySheep['Sheep'/37, l='MpServer', x=249.50, y=69.00, z=195.50], EntityFallingBlock['Falling Block'/1126, l='MpServer', x=131.50, y=10.38, z=219.50], EntityPig['Pig'/40, l='MpServer', x=264.50, y=64.00, z=301.50], EntityFallingBlock['Falling Block'/1124, l='MpServer', x=130.50, y=9.38, z=219.50], EntityPig['Pig'/41, l='MpServer', x=266.50, y=67.00, z=297.50], EntityFallingBlock['Falling Block'/1125, l='MpServer', x=130.50, y=9.38, z=220.50], EntityFallingBlock['Falling Block'/1122, l='MpServer', x=132.50, y=10.38, z=219.50], EntitySkeleton['Skeleton'/521, l='MpServer', x=212.50, y=22.00, z=199.50], EntityFallingBlock['Falling Block'/1123, l='MpServer', x=133.50, y=10.38, z=219.50], EntitySkeleton['Skeleton'/522, l='MpServer', x=209.50, y=22.00, z=201.50], EntityFallingBlock['Falling Block'/1120, l='MpServer', x=135.50, y=8.38, z=221.50], EntityFallingBlock['Falling Block'/1121, l='MpServer', x=131.50, y=10.38, z=220.50], EntityPig['Pig'/53, l='MpServer', x=298.50, y=63.00, z=269.50], EntityPig['Pig'/52, l='MpServer', x=301.50, y=64.00, z=271.50], EntityZombie['Zombie'/661, l='MpServer', x=156.50, y=42.00, z=243.50], EntityCreeper['Creeper'/659, l='MpServer', x=161.50, y=42.00, z=243.50], EntityBat['Bat'/614, l='MpServer', x=189.98, y=28.76, z=194.37], EntityBat['Bat'/615, l='MpServer', x=190.75, y=28.51, z=197.35], EntityBat['Bat'/613, l='MpServer', x=191.66, y=28.50, z=195.25], EntityClientPlayerMP['Player390'/110, l='MpServer', x=221.50, y=68.52, z=264.50], EntitySkeleton['Skeleton'/833, l='MpServer', x=279.50, y=36.00, z=301.50], EntitySkeleton['Skeleton'/597, l='MpServer', x=145.50, y=32.00, z=242.50], EntitySkeleton['Skeleton'/598, l='MpServer', x=142.50, y=32.00, z=243.50], EntitySkeleton['Skeleton'/1078, l='MpServer', x=158.50, y=16.00, z=185.50]]

    Retry entities: 0 total; []

    Server brand: fml,forge

    Server type: Integrated singleplayer server

    Stacktrace:

    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:418)

    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2557)

    at net.minecraft.client.Minecraft.run(Minecraft.java:980)

    at net.minecraft.client.main.Main.main(Main.java:112)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

     

     

     

     

  12. Just use the random function to reduce the chance, IE:

    if(Random.nextInt(5) == 1){
    //Generation code
    }
    

    This will effectively make it 1/5 as common. (Just change the 5 into whatever you want the denominator of the chance fraction to be)

    This is actually what I ended up doing yesterday. Thanks for the tip.

  13. So I have a structure that I am generating, but it is too common. Changing the "chunkX * 16, chunkZ * 16" to "chunkX * 128, chunkZ * 128" makes it rarer but also generates super super slowly.

     

          @Override
            public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
            {
                switch (world.provider.dimensionId)
                {
                case -1:
                    generateNether(world, random, chunkX * 16, chunkZ * 16);
                case 0:
                    generateSurface(world, random, chunkX * 16, chunkZ * 16);
                case 1:
                    generateEnd(world, random, chunkX * 16, chunkZ * 16);
                }
            }
            
            
            private void generateEnd(World world, Random random, int x, int z)
            {
         
            }
         
            private void generateSurface(World world, Random random, int x, int z)
            {
           
            }
            
            private void generateNether(World world, Random random, int x, int z)
            {
            	//Nethengeic Pit Coords//
                int Xcoord = x + random.nextInt(16);
                int Ycoord = 25 + random.nextInt(35);
                int Zcoord = z + random.nextInt(16);
            
                (new NetherTower()).generate(world, random, Xcoord, Ycoord, Zcoord);
    

  14. Just add a variable in your item class called tickssincefired, and every tick increase it by one, and if it = 4 then fire a bullet and set it to 0. This is basic logic. -_-

    The reason you don't do that is because that variable will be the same for every single instance of the Item, making it incompatible in multiplayer for sure, and possibly in single player as well if you have two or more of the item in question.

     

    @OP Your code is close, but when you right click, you forgot to set the time at which it was fired, meaning that every click will allow it to fire as world time > 0 is always true ;)

     

    Add this to your right-click method after determining that you should fire a shot:

    stack.getTagCompound().setLong("lastShotTime", world.getWorldTime() + delay);
    // where 'delay' is an integer equal to the number of ticks you want to delay between shots
    

     

    That should now prevent you from spamming right click to fire quickly, while still allowing you to hold right-click and fire continuously while the item is in use.

    I hate to necro this, but I recently discovered an issue where if you hold down the fire button, it'll keep on firing until you switch weapons even if you let go of holding down fire.

  15. So, I've created a spawner block that uses the TileEntitySpawner, however it only works when I pass the name of Vanilla mobs in, and not my custom (and registered ones) using the registerModEntity.

     

    Edit:

    Okay, so using:

    EntityList.addMapping(MyMob.class, "MyMob", 75);

    fixes the issue.

     

    However, I don't really want to use Vanilla IDs (like the 75, even though it;s a mod-registered mob) so is there any way around that?

  16. This looks very helpful, but it might be a bit much just to make my pet sit. :\

     

    Yeah, it was a bummer when I realized the same thing -- I just wanted to pass one boolean to my model.  However, since then I've been playing with more complicated animations where I pass other states, counters, and such, and you'll probably want to expand into such things too so probably worth setting it up.

     

    However, for quick fix you might be able to use dataWatcher.  It is another method for doing simply syncs of entities.  It has some drawbacks, but only if you're concerned about other people adding mods that interact with your entities and such.

     

    My main point is that you need to get the information to the client entity.  There are multiple ways you can try to do that.

    The only problem is, to use a data watcher (and call it) I need to bind the entity, however the render file doesn't have an entity parameter outside the resource location.

×
×
  • Create New...

Important Information

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