From ef9d1053d85eda9fb8e25dd8b5afecf828fd7a0b Mon Sep 17 00:00:00 2001 From: Runemoro Date: Sun, 31 Dec 2017 11:28:26 -0500 Subject: [PATCH] Make dimensional doors drop the regular door --- src/main/java/org/dimdev/dimdoors/DimDoors.java | 1 - .../shared/blocks/BlockDimensionalDoorGold.java | 8 ++++++++ .../shared/blocks/BlockDimensionalDoorIron.java | 9 +++++++++ .../shared/blocks/BlockDimensionalDoorPersonal.java | 9 ++++++++- .../shared/blocks/BlockDimensionalDoorUnstable.java | 5 ++--- .../shared/blocks/BlockDimensionalDoorWarp.java | 9 +++++++++ .../shared/blocks/BlockDimensionalTrapdoorWood.java | 10 ++++++++++ .../dimdev/dimdoors/shared/blocks/IRiftProvider.java | 1 - .../dimdoors/shared/entities/EntityMonolith.java | 7 ++++--- 9 files changed, 50 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/dimdev/dimdoors/DimDoors.java b/src/main/java/org/dimdev/dimdoors/DimDoors.java index b4712c96..3c145ef9 100644 --- a/src/main/java/org/dimdev/dimdoors/DimDoors.java +++ b/src/main/java/org/dimdev/dimdoors/DimDoors.java @@ -9,7 +9,6 @@ import org.dimdev.dimdoors.shared.world.gateways.GatewayGenerator; import lombok.Getter; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.fml.common.Mod; diff --git a/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorGold.java b/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorGold.java index b1353851..7b9cce90 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorGold.java +++ b/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorGold.java @@ -1,5 +1,6 @@ package org.dimdev.dimdoors.shared.blocks; +import net.minecraft.block.state.IBlockState; import org.dimdev.dimdoors.DimDoors; import org.dimdev.dimdoors.shared.items.ModItems; import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift; @@ -7,6 +8,8 @@ import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; +import java.util.Random; + public class BlockDimensionalDoorGold extends BlockDimensionalDoor { public static final String ID = "gold_dimensional_door"; @@ -23,6 +26,11 @@ public class BlockDimensionalDoorGold extends BlockDimensionalDoor { return ModItems.GOLD_DIMENSIONAL_DOOR; } + @Override + public Item getItemDropped(IBlockState state, Random rand, int fortune) { + return ModBlocks.GOLD_DOOR.getItemDropped(state, rand, fortune); + } + @Override public void setupRift(TileEntityEntranceRift rift) { // TODO diff --git a/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorIron.java b/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorIron.java index a1249bfe..b75f4dad 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorIron.java +++ b/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorIron.java @@ -1,5 +1,7 @@ package org.dimdev.dimdoors.shared.blocks; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; import org.dimdev.dimdoors.DimDoors; import org.dimdev.dimdoors.shared.items.ModItems; import org.dimdev.dimdoors.shared.rifts.NewPublicDestination; @@ -8,6 +10,8 @@ import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; +import java.util.Random; + public class BlockDimensionalDoorIron extends BlockDimensionalDoor { public static final String ID = "dimensional_door"; @@ -25,6 +29,11 @@ public class BlockDimensionalDoorIron extends BlockDimensionalDoor { return ModItems.DIMENSIONAL_DOOR; } + @Override + public Item getItemDropped(IBlockState state, Random rand, int fortune) { + return Blocks.IRON_DOOR.getItemDropped(state, rand, fortune); + } + @Override public void setupRift(TileEntityEntranceRift rift) { NewPublicDestination destination = NewPublicDestination.builder().build(); diff --git a/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorPersonal.java b/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorPersonal.java index c7a32615..240f83b2 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorPersonal.java +++ b/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorPersonal.java @@ -1,16 +1,18 @@ package org.dimdev.dimdoors.shared.blocks; +import net.minecraft.block.state.IBlockState; import org.dimdev.dimdoors.DimDoors; import org.dimdev.dimdoors.shared.items.ModItems; import org.dimdev.dimdoors.shared.rifts.PrivateDestination; import org.dimdev.dimdoors.shared.rifts.PrivatePocketExitDestination; -import org.dimdev.dimdoors.shared.rifts.RiftDestination; import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift; import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderPersonalPocket; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; +import java.util.Random; + public class BlockDimensionalDoorPersonal extends BlockDimensionalDoor { public static final String ID = "quartz_dimensional_door"; @@ -27,6 +29,11 @@ public class BlockDimensionalDoorPersonal extends BlockDimensionalDoor { return ModItems.PERSONAL_DIMENSIONAL_DOOR; } + @Override + public Item getItemDropped(IBlockState state, Random rand, int fortune) { + return ModBlocks.QUARTZ_DOOR.getItemDropped(state, rand, fortune); + } + @Override public void setupRift(TileEntityEntranceRift rift) { if (rift.getWorld().provider instanceof WorldProviderPersonalPocket) { diff --git a/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorUnstable.java b/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorUnstable.java index 259691ff..13aca4c6 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorUnstable.java +++ b/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorUnstable.java @@ -2,13 +2,12 @@ package org.dimdev.dimdoors.shared.blocks; import java.util.Random; +import net.minecraft.init.Blocks; import org.dimdev.dimdoors.DimDoors; import org.dimdev.dimdoors.shared.items.ModItems; import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift; -import net.minecraft.block.BlockDoor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; @@ -31,7 +30,7 @@ public class BlockDimensionalDoorUnstable extends BlockDimensionalDoor { @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? Items.AIR : Items.IRON_DOOR; + return Blocks.IRON_DOOR.getItemDropped(state, rand, fortune); } @Override diff --git a/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorWarp.java b/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorWarp.java index 053a9cfe..f69b4087 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorWarp.java +++ b/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalDoorWarp.java @@ -1,5 +1,7 @@ package org.dimdev.dimdoors.shared.blocks; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; import org.dimdev.dimdoors.DimDoors; import org.dimdev.dimdoors.shared.items.ModItems; import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift; @@ -7,6 +9,8 @@ import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; +import java.util.Random; + public class BlockDimensionalDoorWarp extends BlockDimensionalDoor { public static final String ID = "warp_dimensional_door"; @@ -23,6 +27,11 @@ public class BlockDimensionalDoorWarp extends BlockDimensionalDoor { return ModItems.WARP_DIMENSIONAL_DOOR; } + @Override + public Item getItemDropped(IBlockState state, Random rand, int fortune) { + return Blocks.OAK_DOOR.getItemDropped(state, rand, fortune); + } + @Override public void setupRift(TileEntityEntranceRift rift) { // TODO diff --git a/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalTrapdoorWood.java b/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalTrapdoorWood.java index b7bce4c2..320fde58 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalTrapdoorWood.java +++ b/src/main/java/org/dimdev/dimdoors/shared/blocks/BlockDimensionalTrapdoorWood.java @@ -1,5 +1,8 @@ package org.dimdev.dimdoors.shared.blocks; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; import org.dimdev.dimdoors.DimDoors; import org.dimdev.dimdoors.shared.rifts.EscapeDestination; import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift; @@ -7,6 +10,8 @@ import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.util.ResourceLocation; +import java.util.Random; + public class BlockDimensionalTrapdoorWood extends BlockDimensionalTrapdoor { public static final String ID = "dimensional_trapdoor"; @@ -20,6 +25,11 @@ public class BlockDimensionalTrapdoorWood extends BlockDimensionalTrapdoor { setSoundType(SoundType.WOOD); } + @Override + public Item getItemDropped(IBlockState state, Random rand, int fortune) { + return Blocks.TRAPDOOR.getItemDropped(state, rand, fortune); + } + @Override public void setupRift(TileEntityEntranceRift rift) { rift.setSingleDestination(new EscapeDestination()); diff --git a/src/main/java/org/dimdev/dimdoors/shared/blocks/IRiftProvider.java b/src/main/java/org/dimdev/dimdoors/shared/blocks/IRiftProvider.java index ba9e8505..cf596d58 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/blocks/IRiftProvider.java +++ b/src/main/java/org/dimdev/dimdoors/shared/blocks/IRiftProvider.java @@ -35,6 +35,5 @@ public interface IRiftProvider extends ITileEntityProv //world.setTileEntity(pos, rift); rift.markDirty(); rift.register(); - T rift2 = getRift(world, pos, state); } } diff --git a/src/main/java/org/dimdev/dimdoors/shared/entities/EntityMonolith.java b/src/main/java/org/dimdev/dimdoors/shared/entities/EntityMonolith.java index 6ee01ed3..64a3ca72 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/entities/EntityMonolith.java +++ b/src/main/java/org/dimdev/dimdoors/shared/entities/EntityMonolith.java @@ -1,6 +1,5 @@ package org.dimdev.dimdoors.shared.entities; -import net.minecraft.block.Block; import org.dimdev.dimdoors.shared.sound.ModSounds; import org.dimdev.dimdoors.shared.DDConfig; import org.dimdev.ddutils.Location; @@ -74,7 +73,7 @@ public class EntityMonolith extends EntityFlying implements IMob { @Override public AxisAlignedBB getCollisionBoundingBox() { - return Block.NULL_AABB; // TODO: Is this right? Why check if it intersects anything if it is? + return null; // TODO: Is this right? Why check if it intersects anything if it is? } @Override @@ -282,6 +281,8 @@ public class EntityMonolith extends EntityFlying implements IMob { } } - return world.checkNoEntityCollision(getCollisionBoundingBox()) && world.getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(getCollisionBoundingBox()); + return true; + // TODO: this would throw a null pointer exception if enabled (the bounding box is null) + //return world.checkNoEntityCollision(getCollisionBoundingBox()) && world.getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(getCollisionBoundingBox()); } }