From 480991d1ac07c1715bf090a4d81e988a00803cf3 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 18 Sep 2013 00:01:20 +0100 Subject: Multiple fixes [SEE DESC] - Removed two random block handling files in the item handling section that didn't do anything. (One was an attempt at making slabs work, but failed to realise that the coords would have to be the block CLICKED, and another was just a random empty file for handling wooden planks.) * Fixed placing repeater blocks not directioning properly * Fixed wood directions breaking plank metadata --- source/Blocks/BlockHandler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/Blocks/BlockHandler.cpp') diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp index 3e97d1e9d..e1cfebb56 100644 --- a/source/Blocks/BlockHandler.cpp +++ b/source/Blocks/BlockHandler.cpp @@ -41,6 +41,7 @@ #include "BlockNote.h" #include "BlockOre.h" #include "BlockPiston.h" +#include "BlockPlanks.h" #include "BlockPumpkin.h" #include "BlockRail.h" #include "BlockRedstone.h" @@ -153,7 +154,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_NOTE_BLOCK: return new cBlockNoteHandler (a_BlockType); case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType); case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler (); - case E_BLOCK_PLANKS: return new cBlockWoodHandler (a_BlockType); + case E_BLOCK_PLANKS: return new cBlockPlanksHandler (a_BlockType); case E_BLOCK_PUMPKIN: return new cBlockPumpkinHandler (a_BlockType); case E_BLOCK_JACK_O_LANTERN: return new cBlockPumpkinHandler (a_BlockType); case E_BLOCK_PUMPKIN_STEM: return new cBlockStemsHandler (a_BlockType); -- cgit v1.2.3 From 846f1223f4da984b9992d60ef7c40a092dcd4ad7 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 18 Sep 2013 18:27:21 +0100 Subject: Implemented redstone comparators They can be placed and toggled, but stills needs proper redstone support --- source/Blocks/BlockHandler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/Blocks/BlockHandler.cpp') diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp index e1cfebb56..43330befa 100644 --- a/source/Blocks/BlockHandler.cpp +++ b/source/Blocks/BlockHandler.cpp @@ -13,6 +13,7 @@ #include "BlockChest.h" #include "BlockCloth.h" #include "BlockCobWeb.h" +#include "BlockComparator.h" #include "BlockCrops.h" #include "BlockDeadBush.h" #include "BlockDirt.h" @@ -110,6 +111,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_CAULDRON: return new cBlockCauldronHandler (a_BlockType); case E_BLOCK_CHEST: return new cBlockChestHandler (a_BlockType); case E_BLOCK_COAL_ORE: return new cBlockOreHandler (a_BlockType); + case E_BLOCK_ACTIVE_COMPARATOR: return new cBlockComparatorHandler (a_BlockType); case E_BLOCK_COBBLESTONE: return new cBlockStoneHandler (a_BlockType); case E_BLOCK_COBBLESTONE_STAIRS: return new cBlockStairsHandler (a_BlockType); case E_BLOCK_COBWEB: return new cBlockCobWebHandler (a_BlockType); @@ -124,7 +126,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_DROPPER: return new cBlockDropSpenserHandler (a_BlockType); case E_BLOCK_EMERALD_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_ENDER_CHEST: return new cBlockEnderchestHandler (a_BlockType); - case E_BLOCK_FARMLAND: return new cBlockFarmlandHandler; + case E_BLOCK_FARMLAND: return new cBlockFarmlandHandler ( ); case E_BLOCK_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType); case E_BLOCK_FIRE: return new cBlockFireHandler (a_BlockType); case E_BLOCK_FLOWER_POT: return new cBlockFlowerPotHandler (a_BlockType); @@ -136,6 +138,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_GRAVEL: return new cBlockGravelHandler (a_BlockType); case E_BLOCK_HOPPER: return new cBlockHopperHandler (a_BlockType); case E_BLOCK_ICE: return new cBlockIceHandler (a_BlockType); + case E_BLOCK_INACTIVE_COMPARATOR: return new cBlockComparatorHandler (a_BlockType); case E_BLOCK_IRON_DOOR: return new cBlockDoorHandler (a_BlockType); case E_BLOCK_IRON_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_JUKEBOX: return new cBlockEntityHandler (a_BlockType); @@ -153,7 +156,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_NETHER_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType); case E_BLOCK_NOTE_BLOCK: return new cBlockNoteHandler (a_BlockType); case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType); - case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler (); + case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler ( ); case E_BLOCK_PLANKS: return new cBlockPlanksHandler (a_BlockType); case E_BLOCK_PUMPKIN: return new cBlockPumpkinHandler (a_BlockType); case E_BLOCK_JACK_O_LANTERN: return new cBlockPumpkinHandler (a_BlockType); -- cgit v1.2.3 From 198ac1892ca0751551206ca25164bc691386914b Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 18 Sep 2013 22:20:08 +0100 Subject: Fixed pickups --- source/Blocks/BlockHandler.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'source/Blocks/BlockHandler.cpp') diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp index 43330befa..7d896f1b6 100644 --- a/source/Blocks/BlockHandler.cpp +++ b/source/Blocks/BlockHandler.cpp @@ -358,13 +358,17 @@ void cBlockHandler::DropBlock(cWorld * a_World, cEntity * a_Digger, int a_BlockX if (!Pickups.empty()) { - // Add random offset to the spawn position: - // Commented out until bug with pickups not spawning properly is fixed, see World.cpp - /* - int MicroX = (int)(a_BlockX * 32) + (r1.randInt(16) + r1.randInt(16) - 16); - int MicroY = (int)(a_BlockY * 32) + (r1.randInt(16) + r1.randInt(16) - 16); - int MicroZ = (int)(a_BlockZ * 32) + (r1.randInt(16) + r1.randInt(16) - 16); - */ + MTRand r1; + + // Mid-block position first + int MicroX = (int)(floor(a_BlockX) * 32) + 16; + int MicroY = (int)(floor(a_BlockY) * 32) + 16; + int MicroZ = (int)(floor(a_BlockZ) * 32) + 16; + + // Add random offset second + MicroX = (int)(a_BlockX * 32) + (r1.randInt(16) + r1.randInt(16) - 16); + MicroY = (int)(a_BlockY * 32) + (r1.randInt(16) + r1.randInt(16) - 16); + MicroZ = (int)(a_BlockZ * 32) + (r1.randInt(16) + r1.randInt(16) - 16); a_World->SpawnItemPickups(Pickups, a_BlockX, a_BlockY, a_BlockZ); } -- cgit v1.2.3 From 0c58adb2b440a68ffdfd2967d21019912d390108 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Thu, 19 Sep 2013 21:46:39 +0100 Subject: Fixed pickup block spawning --- source/Blocks/BlockHandler.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'source/Blocks/BlockHandler.cpp') diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp index 7d896f1b6..b06171119 100644 --- a/source/Blocks/BlockHandler.cpp +++ b/source/Blocks/BlockHandler.cpp @@ -361,16 +361,17 @@ void cBlockHandler::DropBlock(cWorld * a_World, cEntity * a_Digger, int a_BlockX MTRand r1; // Mid-block position first - int MicroX = (int)(floor(a_BlockX) * 32) + 16; - int MicroY = (int)(floor(a_BlockY) * 32) + 16; - int MicroZ = (int)(floor(a_BlockZ) * 32) + 16; + double MicroX, MicroY, MicroZ; + MicroX = a_BlockX + 0.5; + MicroY = a_BlockY + 0.5; + MicroZ = a_BlockZ + 0.5; - // Add random offset second - MicroX = (int)(a_BlockX * 32) + (r1.randInt(16) + r1.randInt(16) - 16); - MicroY = (int)(a_BlockY * 32) + (r1.randInt(16) + r1.randInt(16) - 16); - MicroZ = (int)(a_BlockZ * 32) + (r1.randInt(16) + r1.randInt(16) - 16); + // Add random offset second (this causes pickups to spawn inside blocks most times, it's a little buggy) + //MicroX += (int)(r1.randInt(16) + r1.randInt(16) - 16); + //MicroY += (int)(r1.randInt(16) + r1.randInt(16) - 16); + //MicroZ += (int)(r1.randInt(16) + r1.randInt(16) - 16); - a_World->SpawnItemPickups(Pickups, a_BlockX, a_BlockY, a_BlockZ); + a_World->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ); } } -- cgit v1.2.3 From a8a45a4afc615926a705eee482c27ef166f2f9ec Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 22 Sep 2013 19:34:42 +0100 Subject: Added button placement handler Also removed an unneeded variable in the stair handler --- source/Blocks/BlockHandler.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/Blocks/BlockHandler.cpp') diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp index b06171119..e59fee8ee 100644 --- a/source/Blocks/BlockHandler.cpp +++ b/source/Blocks/BlockHandler.cpp @@ -7,6 +7,7 @@ #include "../PluginManager.h" #include "BlockBed.h" #include "BlockBrewingStand.h" +#include "BlockButton.h" #include "BlockCactus.h" #include "BlockCarpet.h" #include "BlockCauldron.h" @@ -185,6 +186,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_STICKY_PISTON: return new cBlockPistonHandler (a_BlockType); case E_BLOCK_STONE: return new cBlockStoneHandler (a_BlockType); case E_BLOCK_STONE_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType); + case E_BLOCK_STONE_BUTTON: return new cBlockButtonHandler (a_BlockType); case E_BLOCK_STONE_SLAB: return new cBlockSlabHandler (a_BlockType); case E_BLOCK_SUGARCANE: return new cBlockSugarcaneHandler (a_BlockType); case E_BLOCK_TALL_GRASS: return new cBlockTallGrassHandler (a_BlockType); @@ -192,6 +194,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_VINES: return new cBlockVineHandler (a_BlockType); case E_BLOCK_WALLSIGN: return new cBlockSignHandler (a_BlockType); case E_BLOCK_WATER: return new cBlockFluidHandler (a_BlockType); + case E_BLOCK_WOODEN_BUTTON: return new cBlockButtonHandler (a_BlockType); case E_BLOCK_WOODEN_DOOR: return new cBlockDoorHandler (a_BlockType); case E_BLOCK_WOODEN_SLAB: return new cBlockSlabHandler (a_BlockType); case E_BLOCK_WOODEN_STAIRS: return new cBlockStairsHandler (a_BlockType); -- cgit v1.2.3