-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWrong Pressure Plate
More file actions
87 lines (75 loc) · 3.11 KB
/
Wrong Pressure Plate
File metadata and controls
87 lines (75 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package net.endbiomes.theendecosystem.block;
import net.minecraftforge.registries.ObjectHolder;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.World;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.item.BlockItem;
import net.minecraft.entity.Entity;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.PressurePlateBlock;
import net.minecraft.block.PressurePlateBlock.Sensitivity;
import net.minecraft.block.SoundType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Block;
import net.endbiomes.theendecosystem.itemgroup.TheEndEcosystemItemGroup;
import net.endbiomes.theendecosystem.TheendecosystemModElements;
import java.util.List;
import java.util.Collections;
@TheendecosystemModElements.ModElement.Tag
public class ElisionPressurePlateBlock extends TheendecosystemModElements.ModElement {
@ObjectHolder("theendecosystem:elision_pressure_plate")
public static final Block block = null;
public ElisionPressurePlateBlock(TheendecosystemModElements instance) {
super(instance, 51);
}
@Override
public void initElements() {
elements.blocks.add(() -> new CustomBlock());
elements.items
.add(() -> new BlockItem(block, new Item.Properties().group(TheEndEcosystemItemGroup.tab)).setRegistryName(block.getRegistryName()));
}
@Override
@OnlyIn(Dist.CLIENT)
public void clientLoad(FMLClientSetupEvent event) {
RenderTypeLookup.setRenderLayer(block, RenderType.getCutout());
}
public static class CustomBlock extends PressurePlateBlock {
public CustomBlock() {
super (PressurePlateBlock.Sensitivity.EVERYTHING, (Block.Properties.create(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(0.5f, 0.5f).lightValue(0).harvestLevel(0)
.harvestTool(ToolType.AXE).doesNotBlockMovement().notSolid()));
setRegistryName("elision_pressure_plate");
}
@Override
public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
return false;
}
@Override
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) {
return true;
}
@Override
public MaterialColor getMaterialColor(BlockState state, IBlockReader blockAccess, BlockPos pos) {
return MaterialColor.AIR;
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
List<ItemStack> dropsOriginal = super.getDrops(state, builder);
if (!dropsOriginal.isEmpty())
return dropsOriginal;
return Collections.singletonList(new ItemStack(this, 1));
}
}
}