mojira.dev

G Cadogan

Assigned

No issues.

Reported

MC-48842 Unable to play unknown soundEvent: minecraft:none Duplicate

Comments

I am seeing this behavior on 14w07a as well.

I am NOT seeing this issue in 14w06b.

Also effects 14w05b. In addition to not placing a block, the count is still decreased by one. For instance: I have 3 blocks of dirt, I try to place one directly in front of me and it fails but now it shows I have 2 blocks of dirt, I pick up a block of dirt and it says I have 4 blocks of dirt.

I am still seeing this on 1.7.4 with Smooth Lighting off. I believe I've resolved the problem with a mod I'm working on. In the ChunkCache class in the getSkyBlockTypeBrightness method, I've replaced the line "return var5;" with these lines:

int varGLC = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3 - 1, par4);

                    if (varGLC > var5)
                    {
                    	var5 = varGLC;
                    }
                    
                    return var5 <= 0 ? var5 : var5 - 1;

Could any modders out there check my changes for any side effects I haven't noticed?

OK, I have another suggestion. So each villager does NOT look at the same door, I've added this as the first line in the method:

Collections.shuffle(this.villageDoorInfoList);

It randomizes the order the villagers look at the doors.

One more thing. In EntityAIMoveIndoors.java, in the shouldExecute method, what is this line for?

if (this.entityObj.getRNG().nextInt(50) != 0)

I only asked because I lack confidence in my own code.

Here is what I have:

Village.java

/**
     * Find a door suitable for shelter. If there are more doors in a distance of 16 blocks, then the least restricted
     * one (i.e. the one protecting the lowest number of villagers) of them is chosen, else the nearest one regardless
     * of restriction.
     */
    public VillageDoorInfo findNearestDoorUnrestricted(int coordX, int coordY, int coordZ)
    {
        VillageDoorInfo bestDoor = null;
        VillageDoorInfo bestDoorOver16 = null;
        int sqrdDistance;
        int lowestOver16 = Integer.MAX_VALUE;
        int lowestCount = Integer.MAX_VALUE;
        Iterator var6 = this.villageDoorInfoList.iterator();

        while (var6.hasNext())
        {
            VillageDoorInfo someDoor = (VillageDoorInfo)var6.next();
            sqrdDistance = someDoor.getDistanceSquared(coordX, coordY, coordZ);

            if (sqrdDistance <= 256)
            {
            	int useCounter; //someDoor.getDoorOpeningRestrictionCounter();
            	
            	// Count villagers behind the door
            	if(someDoor.insideDirectionX==0)
            	{
            		useCounter = this.worldObj.getEntitiesWithinAABB(EntityVillager.class, AxisAlignedBB.getAABBPool().getAABB(someDoor.posX-6, someDoor.posY-2, someDoor.insideDirectionZ<0 ? someDoor.posZ-5 : someDoor.posZ, someDoor.posX+6, someDoor.posY+2, someDoor.insideDirectionZ<0 ? someDoor.posZ : someDoor.posZ+5)).size();
            	}
            	else
            	{
            		useCounter = this.worldObj.getEntitiesWithinAABB(EntityVillager.class, AxisAlignedBB.getAABBPool().getAABB(someDoor.insideDirectionX<0 ? someDoor.posX-5 : someDoor.posX, someDoor.posY-2, someDoor.posZ-6, someDoor.insideDirectionX<0 ? someDoor.posX : someDoor.posX+5, someDoor.posY+2, someDoor.posZ+6)).size();
            	}
            	
            	// Is this count better than previous counts
                if (useCounter < lowestCount)
                {
                    bestDoor = someDoor;
                    lowestCount = useCounter;                
                }
                
                // The best door is the one not used, stop looking
                if (useCounter == 0)
                {
                	break;
                }
            }
            else if (sqrdDistance < lowestOver16)
            {
            	lowestOver16 = sqrdDistance;
            	bestDoorOver16 = someDoor;
            }

        }

        return bestDoor != null ? bestDoor : bestDoorOver16;
    }

It was the "weighted" that through me off. It doesn't seem weighted to me at all. They seem to be using the square of the distance for efficiency. Rather than getting the square root of every formula and comparing it to 16; they were simply comparing it to 256 (16 squared).

That doesn't seem to be a problem. However, using the same variable to compare distance and "restriction counter" is a problem. Using two separate variables would not only be significantly less confusing but more reliable as well.

Even worse, as you say, the "restriction" counter fails to increment when a villager "goes inside".

I believe I have a solution, would you like it?

@Markku In your previous comment you mentioned changing the door selection from distance squared to distance linear. How did you determine distance? For instance, if a door was +3X and -4Z would the distance be 7 weighted by multiplying it times 4?

OK, were the villages generated automatically and then you spawned more villagers or did you build a bunch of houses and spawn villagers in the middle of nowhere?

I'm not seeing this problem. In a few of my villages I have 8 to 12 villagers. At night each there are 3 to 4 villagers in each house. What is the best way to reproduce this defect?

My system seems a little different, just trying to help. Because it continues to suck up RAM, I severely reduced the available memory to Java. At 63M, the problem persisted; at 62M it crashed. Here is my stats:

System.getProperty('os.name') == 'Linux'
System.getProperty('os.version') == '3.2.0-4-amd64'
System.getProperty('os.arch') == 'amd64'
System.getProperty('java.version') == '1.7.0_40'
System.getProperty('java.vendor') == 'Oracle Corporation'
System.getProperty('sun.arch.data.model') == '64'

OpenGL vendor string: nouveau
OpenGL renderer string: Gallium 0.4 on NVA8
OpenGL version string: 2.1 Mesa 8.0.5
OpenGL shading language version string: 1.20

Linux Distro: Debian 3.2.51-1 (Wheezy)
Memory: 2 Gb
Processor: Intel® Pentium(R) 4 CPU 3.60GHz × 2
Graphics: Gallium 0.4 on NVA8
Graphics Card: NVIDIA Corporation GT218 [GeForce 210] (rev a2)

JVM Arguments: -Xmx63M (Does not crash, but doesn't play either)
JVM Arguments: -Xmx62M (Crashes)