-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix door drop item
- Loading branch information
Alexander Kornilov
committed
Jun 29, 2018
1 parent
81c3f98
commit 56a89b9
Showing
15 changed files
with
227 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/ru/kordum/totemDefender/block/BlockDoor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,36 @@ | ||
package ru.kordum.totemDefender.block; | ||
|
||
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.item.ItemStack; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import ru.kordum.totemDefender.handler.ItemRegistry; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.Random; | ||
|
||
public class BlockDoor extends net.minecraft.block.BlockDoor { | ||
public BlockDoor() { | ||
super(Material.WOOD); | ||
setHardness(4); | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public Item getItemDropped(IBlockState state, Random rand, int fortune) { | ||
return state.getValue(HALF) == EnumDoorHalf.UPPER ? Items.AIR : getItem(); | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { | ||
return new ItemStack(getItem()); | ||
} | ||
|
||
private Item getItem() { | ||
return ItemRegistry.DOOR; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.