diff --git a/src/main/java/net/minecraft/client/entity/fx/EntityPickupFX.java b/src/main/java/net/minecraft/client/entity/fx/EntityPickupFX.java
index fde4e3413..306f097a2 100644
--- a/src/main/java/net/minecraft/client/entity/fx/EntityPickupFX.java
+++ b/src/main/java/net/minecraft/client/entity/fx/EntityPickupFX.java
@@ -3,6 +3,7 @@ package net.minecraft.client.entity.fx;
 import net.minecraft.core.entity.Entity;
 import net.minecraft.core.util.helper.MathHelper;
 import net.minecraft.client.render.EntityRenderDispatcher;
+import net.minecraft.client.render.LightmapHelper;
 import net.minecraft.client.render.tessellator.Tessellator;
 import net.minecraft.core.world.World;
 import org.lwjgl.opengl.GL11;
@@ -41,11 +42,16 @@ public class EntityPickupFX extends EntityFX
         int i = MathHelper.floor_double(d6);
         int j = MathHelper.floor_double(d7 + (double)(this.heightOffset / 2.0F));
         int k = MathHelper.floor_double(d8);
-        float f7 = world.getLightBrightness(i, j, k);
         d6 -= lerpPosX;
         d7 -= lerpPosY;
         d8 -= lerpPosZ;
-        GL11.glColor4f(f7, f7, f7, 1.0F);
+        float brightness = 1.0f;
+        if(LightmapHelper.isLightmapEnabled()) {
+        	LightmapHelper.setLightmapCoord(itemEntity.world.getLightmapCoord(i, j, k, 0));
+        }else {
+        	brightness = world.getLightBrightness(i, j, k);
+        }
+        GL11.glColor4f(brightness, brightness, brightness, 1.0F);
         EntityRenderDispatcher.instance.renderEntityWithPosYaw(t, itemEntity, (float)d6, (float)d7, (float)d8, itemEntity.yRot, partialTick);
     }
 
diff --git a/src/main/java/net/minecraft/client/render/block/model/BlockModelJar.java b/src/main/java/net/minecraft/client/render/block/model/BlockModelJar.java
index 8fdce1abc..28869cd8a 100644
--- a/src/main/java/net/minecraft/client/render/block/model/BlockModelJar.java
+++ b/src/main/java/net/minecraft/client/render/block/model/BlockModelJar.java
@@ -1,5 +1,6 @@
 package net.minecraft.client.render.block.model;
 
+import net.minecraft.client.render.LightmapHelper;
 import net.minecraft.client.render.stitcher.IconCoordinate;
 import net.minecraft.client.render.stitcher.TextureRegistry;
 import net.minecraft.client.render.tessellator.Tessellator;
@@ -17,7 +18,12 @@ public class BlockModelJar<T extends Block> extends BlockModelStandard<T> {
     public boolean render(Tessellator tessellator, int x, int y, int z) {
         block.setBlockBoundsBasedOnState(renderBlocks.blockAccess, x, y, z);
         // todo: yes, i know this is horrible.
-        float brightness = getBlockBrightness(renderBlocks.blockAccess, x, y, z);
+        float brightness = 1.0f;
+        if(LightmapHelper.isLightmapEnabled()) {
+        	tessellator.setLightmapCoord(block.getLightmapCoord(renderBlocks.blockAccess, x, y, z));
+        }else {
+        	brightness = getBlockBrightness(renderBlocks.blockAccess, x, y, z);
+        }
         float yOffset = 0f;
         int meta = renderBlocks.blockAccess.getBlockMetadata(x, y, z);
 
diff --git a/src/main/java/net/minecraft/client/render/block/model/BlockModelPebbles.java b/src/main/java/net/minecraft/client/render/block/model/BlockModelPebbles.java
index e3f2505d8..a94e90297 100644
--- a/src/main/java/net/minecraft/client/render/block/model/BlockModelPebbles.java
+++ b/src/main/java/net/minecraft/client/render/block/model/BlockModelPebbles.java
@@ -1,5 +1,6 @@
 package net.minecraft.client.render.block.model;
 
+import net.minecraft.client.render.LightmapHelper;
 import net.minecraft.client.render.stitcher.IconCoordinate;
 import net.minecraft.client.render.stitcher.TextureRegistry;
 import net.minecraft.client.render.tessellator.Tessellator;
@@ -21,14 +22,13 @@ public class BlockModelPebbles<T extends Block> extends BlockModelStandard<T> {
     public boolean render(Tessellator tessellator, int x, int y, int z) {
         block.setBlockBoundsBasedOnState(renderBlocks.blockAccess, x, y, z);
         float f1 = 1.0F;
-
-        float f4 = getBlockBrightness(renderBlocks.blockAccess, x, y, z);
-        float f5 = getBlockBrightness(renderBlocks.blockAccess, x, y - 1, z);
-        if(f5 < f4)
-        {
-            f5 = f4;
+        float brightness = 1.0f;
+        if(LightmapHelper.isLightmapEnabled()) {
+        	tessellator.setLightmapCoord(LightmapHelper.max(block.getLightmapCoord(renderBlocks.blockAccess, x, y, z), block.getLightmapCoord(renderBlocks.blockAccess, x, y - 1, z)));
+        }else {
+        	brightness = Math.max(getBlockBrightness(renderBlocks.blockAccess, x, y, z), getBlockBrightness(renderBlocks.blockAccess, x, y - 1, z));
         }
-        tessellator.setColorOpaque_F(f1 * f5, f1 * f5, f1 * f5);
+        tessellator.setColorOpaque_F(f1 * brightness, f1 * brightness, f1 * brightness);
         IconCoordinate j = getBlockTextureFromSideAndMetadata(Side.TOP, renderBlocks.blockAccess.getBlockMetadata(x, y, z));
         renderTopFace(tessellator, block, x, y, z, j);
 
diff --git a/src/main/java/net/minecraft/client/render/block/model/BlockModelPistonHead.java b/src/main/java/net/minecraft/client/render/block/model/BlockModelPistonHead.java
index 13afd2fc5..1590095f4 100644
--- a/src/main/java/net/minecraft/client/render/block/model/BlockModelPistonHead.java
+++ b/src/main/java/net/minecraft/client/render/block/model/BlockModelPistonHead.java
@@ -1,5 +1,6 @@
 package net.minecraft.client.render.block.model;
 
+import net.minecraft.client.render.LightmapHelper;
 import net.minecraft.client.render.stitcher.IconCoordinate;
 import net.minecraft.client.render.stitcher.TextureRegistry;
 import net.minecraft.client.render.tessellator.Tessellator;
@@ -29,7 +30,12 @@ public class BlockModelPistonHead extends BlockModelStandard<BlockPistonHead> {
     protected boolean renderPistonHead(Tessellator tessellator, BlockPistonHead block, int x, int y, int z, boolean flag) {
         int metadata = renderBlocks.blockAccess.getBlockMetadata(x, y, z);
         int direction = BlockPistonHead.getDirectionFromMeta(metadata);
-        float brightness = getBlockBrightness(renderBlocks.blockAccess, x, y, z);
+        float brightness = 1.0f;
+        if(LightmapHelper.isLightmapEnabled()) {
+        	tessellator.setLightmapCoord(block.getLightmapCoord(renderBlocks.blockAccess, x, y, z));
+        }else {
+        	brightness = getBlockBrightness(renderBlocks.blockAccess, x, y, z);
+        }
         float f1 = flag ? 1.0F : 0.5F;
         double width = flag ? 1 : 1/2d;
         switch(direction)
diff --git a/src/main/java/net/minecraft/client/render/entity/MinecartRenderer.java b/src/main/java/net/minecraft/client/render/entity/MinecartRenderer.java
index cce32babd..dd6a4a5fd 100644
--- a/src/main/java/net/minecraft/client/render/entity/MinecartRenderer.java
+++ b/src/main/java/net/minecraft/client/render/entity/MinecartRenderer.java
@@ -1,6 +1,7 @@
 package net.minecraft.client.render.entity;
 
 import net.minecraft.client.Minecraft;
+import net.minecraft.client.render.LightmapHelper;
 import net.minecraft.client.render.block.model.BlockModelDispatcher;
 import net.minecraft.client.render.model.ModelBase;
 import net.minecraft.client.render.model.ModelMinecart;
@@ -82,8 +83,14 @@ public class MinecartRenderer extends EntityRenderer<EntityMinecart>
             GL11.glScalef(f5, f5, f5);
             GL11.glTranslatef(0.0F, 0.3125F, 0.0F);
             GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
-            float brightness = minecart.getBrightness(f1);
-            if (Global.accessor.isFullbrightEnabled()) brightness = 1.0f;
+            float brightness = 1.0f;
+            if(LightmapHelper.isLightmapEnabled()) {
+            	LightmapHelper.setLightmapCoord(minecart.getLightmapCoord(f1));
+            }else if(Global.accessor.isFullbrightEnabled()) {
+            	
+            }else {
+            	brightness = minecart.getBrightness(f1);
+            }
             if(minecart.minecartType == 1)
             {
                 BlockModelDispatcher.getInstance().getDispatch(Block.chestPlanksOak).renderBlockOnInventory(tessellator, 0, brightness);
diff --git a/src/main/java/net/minecraft/client/render/entity/PaintingRenderer.java b/src/main/java/net/minecraft/client/render/entity/PaintingRenderer.java
index 5651cce7f..a4557809b 100644
--- a/src/main/java/net/minecraft/client/render/entity/PaintingRenderer.java
+++ b/src/main/java/net/minecraft/client/render/entity/PaintingRenderer.java
@@ -1,5 +1,6 @@
 package net.minecraft.client.render.entity;
 
+import net.minecraft.client.render.LightmapHelper;
 import net.minecraft.client.render.stitcher.IconCoordinate;
 import net.minecraft.client.render.stitcher.TextureRegistry;
 import net.minecraft.client.render.tessellator.Tessellator;
@@ -125,7 +126,9 @@ public class PaintingRenderer extends EntityRenderer<EntityPainting>
             worldZ = MathHelper.floor_double(entity.z + (double)(centerX / 16F));
         }
         float brightness = renderDispatcher.world.getLightBrightness(worldX, worldY, worldZ);
-        if (Global.accessor.isFullbrightEnabled()) brightness = 1.0f;
+        if (Global.accessor.isFullbrightEnabled() || LightmapHelper.isLightmapEnabled()) {
+        	brightness = 1.0f;
+        }
         GL11.glColor3f(brightness, brightness, brightness);
     }
 
diff --git a/src/main/java/net/minecraft/client/render/item/model/ItemModelStandard.java b/src/main/java/net/minecraft/client/render/item/model/ItemModelStandard.java
index fdd4ec3e2..fb521806d 100644
--- a/src/main/java/net/minecraft/client/render/item/model/ItemModelStandard.java
+++ b/src/main/java/net/minecraft/client/render/item/model/ItemModelStandard.java
@@ -95,7 +95,9 @@ public class ItemModelStandard extends ItemModel{
 
     @Override
     public void renderItem(Tessellator tessellator, ItemRenderer renderer, ItemStack itemstack, @Nullable Entity entity, float brightness, boolean handheldTransform) {
-        if (itemfullBright) brightness = 1f;
+        if (itemfullBright || LightmapHelper.isLightmapEnabled()) {
+        	brightness = 1.0f;
+        }
         if(handheldTransform) {
             GL11.glTranslatef(-0.0F, -0.3F, 0.0F);
             final float handheldScale = 1.5F;
diff --git a/src/main/java/net/minecraft/client/render/model/ModelWolf.java b/src/main/java/net/minecraft/client/render/model/ModelWolf.java
index 4421ca952..1e0ac5784 100644
--- a/src/main/java/net/minecraft/client/render/model/ModelWolf.java
+++ b/src/main/java/net/minecraft/client/render/model/ModelWolf.java
@@ -1,6 +1,7 @@
 package net.minecraft.client.render.model;
 
 import net.minecraft.client.Minecraft;
+import net.minecraft.client.render.LightmapHelper;
 import net.minecraft.core.Global;
 import net.minecraft.core.entity.EntityLiving;
 import net.minecraft.core.entity.animal.EntityWolf;
@@ -124,8 +125,14 @@ public class ModelWolf extends ModelBase
 
         if(entitywolf.getWolfShaking())
         {
-            float brightness = entitywolf.getBrightness(partialTick);
-            if (Global.accessor.isFullbrightEnabled()) brightness = 1.0f;
+            float brightness = 1.0f;
+            if(LightmapHelper.isLightmapEnabled()) {
+            	LightmapHelper.setLightmapCoord(entitywolf.getLightmapCoord(partialTick));
+            }else if(Global.accessor.isFullbrightEnabled()) {
+            	
+            }else {
+            	brightness = entitywolf.getBrightness(partialTick);
+            }
             float f4 = brightness * entitywolf.getShadingWhileShaking(partialTick);
             GL11.glColor3f(f4, f4, f4);
         }
diff --git a/src/main/java/net/minecraft/core/block/BlockCropsWheat.java b/src/main/java/net/minecraft/core/block/BlockCropsWheat.java
index 1ac98285b..7a9c4e628 100644
--- a/src/main/java/net/minecraft/core/block/BlockCropsWheat.java
+++ b/src/main/java/net/minecraft/core/block/BlockCropsWheat.java
@@ -111,7 +111,7 @@ public class BlockCropsWheat extends BlockFlower implements IBonemealable
     @Override
     public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta, EntityPlayer player, Item item) {
         boolean isFertilized = BlockFarmland.isFertilized(world.getBlockMetadata(x, y - 1, z));
-        if (isFertilized) {
+        if (isFertilized && !world.isClientSide) {
             boolean shouldDefertilize = world.rand.nextInt(3) == 2;
             if (shouldDefertilize) {
                 world.setBlockMetadata(x, y - 1, z, BlockFarmland.setFertilized(world.getBlockMetadata(x, y - 1, z), false));
diff --git a/src/main/java/net/minecraft/core/entity/EntityItem.java b/src/main/java/net/minecraft/core/entity/EntityItem.java
index 9a85cadd1..0769b291d 100644
--- a/src/main/java/net/minecraft/core/entity/EntityItem.java
+++ b/src/main/java/net/minecraft/core/entity/EntityItem.java
@@ -212,7 +212,7 @@ public class EntityItem extends Entity
 				}
 				
 				if(item.stackSize <= 0) {
-					world.playSoundAtEntity(null, this, "random.pop", 0.2F, ((random.nextFloat() - random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+					world.playSoundAtEntity(player, this, "random.pop", 0.2F, ((random.nextFloat() - random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
 					player.onItemPickup(this, item.itemID);	
 				}
 
diff --git a/src/main/java/net/minecraft/core/entity/projectile/EntityArrow.java b/src/main/java/net/minecraft/core/entity/projectile/EntityArrow.java
index f9bccaf6e..d8763e36a 100644
--- a/src/main/java/net/minecraft/core/entity/projectile/EntityArrow.java
+++ b/src/main/java/net/minecraft/core/entity/projectile/EntityArrow.java
@@ -21,14 +21,23 @@ import net.minecraft.core.world.World;
 
 public class EntityArrow extends EntityProjectile
 {
-    protected int xTile;
-    protected int yTile;
-    protected int zTile;
-    protected int inTile;
-    public int shake;
-    protected int inData;
+    protected int xTile = -1;
+    protected int yTile = -1;
+    protected int zTile = -1;
+    protected int inTile = 0;
+    public int shake = 0;
+    protected int inData = 0;
     protected int arrowType;
     protected ItemStack stack = new ItemStack(Item.ammoArrow);
+    
+    /*
+     * I have reverted these to not be synced in multiplayer,
+     * because arrows shot into the ground by players were very jittery.
+     * Because of that the arrow break particles don't work in multiplayer,
+     * this needs to be fixed with a SpawnParticle packet
+     */
+    protected boolean inGround = false;
+    protected boolean doesArrowBelongToPlayer = false;
 
 	public EntityArrow(World world) {
 		this(world, 0);
@@ -37,36 +46,18 @@ public class EntityArrow extends EntityProjectile
     public EntityArrow(World world, int arrowType)
     {
         super(world);
-        xTile = -1;
-        yTile = -1;
-        zTile = -1;
-        inTile = 0;
-        shake = 0;
-        inData = 0;
         this.arrowType = arrowType;
     }
 
     public EntityArrow(World world, double d, double d1, double d2, int arrowType)
     {
         super(world, d, d1, d2);
-        xTile = -1;
-        yTile = -1;
-        zTile = -1;
-        inTile = 0;
-        shake = 0;
-        inData = 0;
         this.arrowType = arrowType;
     }
 
     public EntityArrow(World world, EntityLiving entityliving, boolean doesArrowBelongToPlayer, int arrowType)
     {
         super(world, entityliving);
-        xTile = -1;
-        yTile = -1;
-        zTile = -1;
-        inTile = 0;
-        shake = 0;
-        inData = 0;
         setDoesArrowBelongToPlayer(doesArrowBelongToPlayer);
         this.arrowType = arrowType;
     }
@@ -76,24 +67,25 @@ public class EntityArrow extends EntityProjectile
     {
         super.init();
         damage = 5;
-        entityData.define(15, (byte)0);
-        entityData.define(16, (byte)0);
-        if(!(owner instanceof EntityPlayer))
-            setDoesArrowBelongToPlayer(false);
 
     }
-    public void setDoesArrowBelongToPlayer(boolean flag){
-        entityData.set(15, flag ? (byte)1 : (byte)0);
+    
+    public void setDoesArrowBelongToPlayer(boolean flag) {
+    	this.doesArrowBelongToPlayer = flag;
     }
-    public boolean arrowBelongsToPlayer(){
-        return entityData.getByte(15) != 0;
+    
+    public boolean arrowBelongsToPlayer() {
+    	return doesArrowBelongToPlayer;
     }
-    public void setGrounded(boolean flag){
-        entityData.set(16, flag ? (byte)1 : (byte)0);
+    
+    public void setGrounded(boolean flag) {
+    	this.inGround = flag;
     }
-    public boolean isGrounded(){
-        return entityData.getByte(16) != 0;
+    
+    public boolean isGrounded() {
+    	return inGround;
     }
+    
     @Override
 	public void lerpMotion(double xd, double yd, double zd)
     {
@@ -211,10 +203,13 @@ public class EntityArrow extends EntityProjectile
     
     protected void inGroundAction()
     {
-        if (!arrowBelongsToPlayer()){
-            if(!world.isClientSide) {
-                world.playSoundAtEntity(null, this, "random.drr", 1.0F, 1.2F / (random.nextFloat() * 0.2F + 0.9F));
-            }
+    	if(world.isClientSide) {
+            setGrounded(true);
+            shake = 7;
+            return;
+    	}
+        if (!arrowBelongsToPlayer()) {
+            world.playSoundAtEntity(null, this, "random.drr", 1.0F, 1.2F / (random.nextFloat() * 0.2F + 0.9F));
             for(int j = 0; j < 4; j++)
             {
                 world.spawnParticle("item", x, y, z, 0.0, 0.0D, 0.0D, Item.ammoArrow.id);
@@ -222,9 +217,7 @@ public class EntityArrow extends EntityProjectile
             remove();
             return;
         }
-        if(!world.isClientSide) {
-            world.playSoundAtEntity(null, this, "random.drr", 1.0F, 1.2F / (random.nextFloat() * 0.2F + 0.9F));
-        }
+        world.playSoundAtEntity(null, this, "random.drr", 1.0F, 1.2F / (random.nextFloat() * 0.2F + 0.9F));
         setGrounded(true);
         shake = 7;
     }
@@ -272,7 +265,7 @@ public class EntityArrow extends EntityProjectile
         {
         	player.inventory.insertItem(stack, true);
         	if(stack.stackSize <= 0) {
-                world.playSoundAtEntity(null, this, "random.pop", 0.2F, ((random.nextFloat() - random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+                world.playSoundAtEntity(player, this, "random.pop", 0.2F, ((random.nextFloat() - random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
                 player.onItemPickup(this, stack.itemID);
                 remove();
         	}
diff --git a/src/main/java/net/minecraft/core/item/ItemBow.java b/src/main/java/net/minecraft/core/item/ItemBow.java
index 677da886c..6df182e85 100644
--- a/src/main/java/net/minecraft/core/item/ItemBow.java
+++ b/src/main/java/net/minecraft/core/item/ItemBow.java
@@ -30,7 +30,6 @@ public class ItemBow extends Item
             itemstack.damageItem(1, entityplayer);
             world.playSoundAtEntity(entityplayer, entityplayer, "random.bow", 0.3f, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
             if (!world.isClientSide) {
-                world.playSoundAtEntity(null, entityplayer, "random.bow", 0.3f, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
                 world.entityJoinedWorld(new EntityArrow(world, entityplayer, true, 0));
             }
         }
@@ -38,7 +37,6 @@ public class ItemBow extends Item
             itemstack.damageItem(1, entityplayer);
             world.playSoundAtEntity(entityplayer, entityplayer, "random.bow", 0.3f, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
             if (!world.isClientSide) {
-                world.playSoundAtEntity(null, entityplayer, "random.bow", 0.3f, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
                 world.entityJoinedWorld(new EntityArrowPurple(world, entityplayer, false));
             }
         }
@@ -48,7 +46,6 @@ public class ItemBow extends Item
             world.playSoundAtEntity(entityplayer, entityplayer, "random.bow", 0.3f, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
             if(!world.isClientSide)
             {
-                world.playSoundAtEntity(null, entityplayer, "random.bow", 0.3f, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
                 world.entityJoinedWorld(new EntityArrowGolden(world, entityplayer, true));
             }
         }
@@ -58,7 +55,6 @@ public class ItemBow extends Item
             world.playSoundAtEntity(entityplayer, entityplayer, "random.bow", 0.3f, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
             if(!world.isClientSide)
             {
-                world.playSoundAtEntity(null, entityplayer, "random.bow", 0.3f, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
                 world.entityJoinedWorld(new EntityArrow(world, entityplayer, true, 0));
             }
         }
diff --git a/src/main/java/net/minecraft/core/util/helper/MathHelper.java b/src/main/java/net/minecraft/core/util/helper/MathHelper.java
index 9e05ea24c..234f3bbd0 100644
--- a/src/main/java/net/minecraft/core/util/helper/MathHelper.java
+++ b/src/main/java/net/minecraft/core/util/helper/MathHelper.java
@@ -130,6 +130,11 @@ public class MathHelper
 
     public static final float PI = (float)Math.PI;
 
+    public static int maxAbs(int a, int b)
+    {
+        return Math.abs(a) > Math.abs(b) ? a : b;
+    }
+
     static 
     {
         SIN_TABLE = new float[0x10000];
diff --git a/src/main/java/net/minecraft/core/world/generate/feature/tree/spooner/WorldFeatureSpoonerTreeProcedural.java b/src/main/java/net/minecraft/core/world/generate/feature/tree/spooner/WorldFeatureSpoonerTreeProcedural.java
index 5fc014537..f4aaaf686 100644
--- a/src/main/java/net/minecraft/core/world/generate/feature/tree/spooner/WorldFeatureSpoonerTreeProcedural.java
+++ b/src/main/java/net/minecraft/core/world/generate/feature/tree/spooner/WorldFeatureSpoonerTreeProcedural.java
@@ -83,7 +83,7 @@ public abstract class WorldFeatureSpoonerTreeProcedural
         // delta is the coordinate vector for the difference between
         // start and end.
         int[] delta = new int[] { end[0] - start[0], end[1] - start[1], end[2] - start[2] };
-        int maxDist = Math.max(delta[0], Math.max(delta[1], delta[2]));
+        int maxDist = MathHelper.maxAbs(delta[0], MathHelper.maxAbs(delta[1], delta[2]));
         if (maxDist == 0) {
             return;
         }
@@ -112,7 +112,10 @@ public abstract class WorldFeatureSpoonerTreeProcedural
         // Loop through each cross-section along the primary axis,
         // from start to end.
         int endOffset = delta[primidx] + primSign;
-        for (int primOffset = 0; primOffset < endOffset; primOffset += primSign) {
+        int endOffsetAbs = Math.abs(endOffset);
+        int iterator = Math.abs(primSign);
+        for (int primOffsetAbs = 0; primOffsetAbs < endOffsetAbs; primOffsetAbs += iterator) {
+            int primOffset = primOffsetAbs * primSign;
             int primLoc = start[primidx] + primOffset;
             int secloc1 = (int)(start[secidx1] + primOffset * secfac1);
             int secloc2 = (int)(start[secidx2] + primOffset * secfac2);
@@ -151,21 +154,23 @@ public abstract class WorldFeatureSpoonerTreeProcedural
         }
         for (int[] coord: foliageCoords) {
             double dist = Math.sqrt(Math.pow(coord[0] - treePosition[0], 2) + Math.pow(coord[2] - treePosition[2], 2));
-            int yDist = coord[1] - treePosition[1];
-            double value = (this.branchDensity * 220 * height) / (Math.pow(yDist + dist, 3));
-            if (value < random.nextDouble()) {
-                continue;
-            }
+              // supposed to cull branches at certain points but seems to just leave floating heads. Removed for now.
+//            int yDist = coord[1] - treePosition[1];
+//            double value = (this.branchDensity * 220 * height) / (Math.pow(yDist + dist, 3));
+//            if (value < random.nextDouble()) {
+//                continue;
+//            }
 
             int posY = coord[1];
             double slope = this.branchSlope + (0.5 - random.nextDouble()) * 0.16;
             double branchY;
             double baseSize;
             if (coord[1] - dist * slope > topY) {
-                double threshold = 1.0 / height;
-                if (Math.random() < threshold) {
-                    continue;
-                }
+                  // this too
+//                double threshold = 1.0 / height;
+//                if (Math.random() < threshold) {
+//                    continue;
+//                }
                 branchY = topY;
                 baseSize = endRad;
             } else {
