Lumecorn & lanceleaf drop fix (#128)
This commit is contained in:
parent
59190485f3
commit
941b2ace9f
2 changed files with 16 additions and 12 deletions
|
@ -1,8 +1,13 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.context.LootContext;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.state.property.EnumProperty;
|
import net.minecraft.state.property.EnumProperty;
|
||||||
import net.minecraft.state.property.IntProperty;
|
import net.minecraft.state.property.IntProperty;
|
||||||
|
@ -13,6 +18,7 @@ import net.minecraft.world.WorldView;
|
||||||
import ru.betterend.blocks.BlockProperties.PentaShape;
|
import ru.betterend.blocks.BlockProperties.PentaShape;
|
||||||
import ru.betterend.blocks.basis.EndPlantBlock;
|
import ru.betterend.blocks.basis.EndPlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
import ru.betterend.util.MHelper;
|
||||||
|
|
||||||
public class LanceleafBlock extends EndPlantBlock {
|
public class LanceleafBlock extends EndPlantBlock {
|
||||||
public static final EnumProperty<PentaShape> SHAPE = BlockProperties.PENTA_SHAPE;
|
public static final EnumProperty<PentaShape> SHAPE = BlockProperties.PENTA_SHAPE;
|
||||||
|
@ -50,4 +56,12 @@ public class LanceleafBlock extends EndPlantBlock {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||||
|
if (state.get(SHAPE) == PentaShape.BOTTOM) {
|
||||||
|
return Collections.singletonList(new ItemStack(EndBlocks.LANCELEAF_SEED));
|
||||||
|
}
|
||||||
|
return MHelper.RANDOM.nextBoolean() ? Collections.emptyList() : Collections.singletonList(new ItemStack(EndBlocks.LANCELEAF_SEED));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,19 +88,9 @@ public class LumecornBlock extends BlockBaseNotFull implements IRenderTypeable {
|
||||||
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||||
LumecornShape shape = state.get(SHAPE);
|
LumecornShape shape = state.get(SHAPE);
|
||||||
if (shape == LumecornShape.BOTTOM_BIG || shape == LumecornShape.BOTTOM_SMALL || shape == LumecornShape.MIDDLE) {
|
if (shape == LumecornShape.BOTTOM_BIG || shape == LumecornShape.BOTTOM_SMALL || shape == LumecornShape.MIDDLE) {
|
||||||
if (MHelper.RANDOM.nextBoolean()) {
|
return Collections.singletonList(new ItemStack(EndBlocks.LUMECORN_SEED, MHelper.randRange(1, 2, MHelper.RANDOM)));
|
||||||
return Collections.singletonList(new ItemStack(EndBlocks.LUMECORN_SEED));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (MHelper.RANDOM.nextBoolean()) {
|
|
||||||
return Collections.singletonList(new ItemStack(EndItems.LUMECORN_ROD));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
}
|
||||||
|
return MHelper.RANDOM.nextBoolean() ? Collections.singletonList(new ItemStack(EndItems.LUMECORN_ROD)) : Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue