Skip to content

Commit

Permalink
Merge pull request #20 from manmaed/master
Browse files Browse the repository at this point in the history
fixes the long break times on blocks
  • Loading branch information
Gaz492 authored Aug 18, 2023
2 parents 22f5e3f + 1efd058 commit 513fb23
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
11 changes: 6 additions & 5 deletions common/src/main/java/dev/wuffs/playerplates/PPRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrySupplier;
import dev.wuffs.playerplates.Block.PlayerPlateBlock;
import dev.wuffs.playerplates.block.PlayerPlateBlock;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.properties.BlockSetType;

import java.util.function.Supplier;
Expand All @@ -17,14 +18,14 @@ public class PPRegistry {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(PlayerPlates.MOD_ID, Registries.BLOCK);
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(PlayerPlates.MOD_ID, Registries.ITEM);

public static final RegistrySupplier<Block> OBSIDIAN_PLATE_BLOCK = BLOCKS.register("obsidian_plate", () -> new PlayerPlateBlock(PlayerPlateBlock.Sensitivity.PLAYER, false,50.0f, 6000.0f, BlockSetType.STONE));
public static final RegistrySupplier<Block> OBSIDIAN_PLATE_BLOCK = BLOCKS.register("obsidian_plate", () -> new PlayerPlateBlock(PlayerPlateBlock.Sensitivity.PLAYER, false, Blocks.OBSIDIAN, BlockSetType.STONE));
public static final RegistrySupplier<Item> OBSIDIAN_PLATE_ITEM = blockItem("obsidian_plate", OBSIDIAN_PLATE_BLOCK);
public static final RegistrySupplier<Block> INVISIBLE_OBSIDIAN_PLATE_BLOCK = BLOCKS.register("invisible_obsidian_plate", () -> new PlayerPlateBlock(PlayerPlateBlock.Sensitivity.PLAYER, true,50.0f, 6000.0f, BlockSetType.STONE));
public static final RegistrySupplier<Block> INVISIBLE_OBSIDIAN_PLATE_BLOCK = BLOCKS.register("invisible_obsidian_plate", () -> new PlayerPlateBlock(PlayerPlateBlock.Sensitivity.PLAYER, true,Blocks.OBSIDIAN, BlockSetType.STONE));
public static final RegistrySupplier<Item> INVISIBLE_OBSIDIAN_PLATE_ITEM = blockItem("invisible_obsidian_plate", INVISIBLE_OBSIDIAN_PLATE_BLOCK);

public static final RegistrySupplier<Block> MOSSY_PLATE_BLOCK = BLOCKS.register("mossy_plate", () -> new PlayerPlateBlock(PlayerPlateBlock.Sensitivity.ITEMS_MOB, false,1.0f, 1.0f, BlockSetType.STONE));
public static final RegistrySupplier<Block> MOSSY_PLATE_BLOCK = BLOCKS.register("mossy_plate", () -> new PlayerPlateBlock(PlayerPlateBlock.Sensitivity.ITEMS_MOB, false, Blocks.MOSSY_COBBLESTONE, BlockSetType.STONE));
public static final RegistrySupplier<Item> MOSSY_PLATE_ITEM = blockItem("mossy_plate", MOSSY_PLATE_BLOCK);
public static final RegistrySupplier<Block> INVISIBLE_MOSSY_PLATE_BLOCK = BLOCKS.register("invisible_mossy_plate", () -> new PlayerPlateBlock(PlayerPlateBlock.Sensitivity.ITEMS_MOB, true,1.0f, 1.0f, BlockSetType.STONE));
public static final RegistrySupplier<Block> INVISIBLE_MOSSY_PLATE_BLOCK = BLOCKS.register("invisible_mossy_plate", () -> new PlayerPlateBlock(PlayerPlateBlock.Sensitivity.ITEMS_MOB, true, Blocks.MOSSY_COBBLESTONE, BlockSetType.STONE));
public static final RegistrySupplier<Item> INVISIBLE_MOSSY_PLATE_ITEM = blockItem("invisible_mossy_plate", INVISIBLE_MOSSY_PLATE_BLOCK);

private static RegistrySupplier<Item> blockItem(String id, Supplier<Block> b) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.wuffs.playerplates.Block;
package dev.wuffs.playerplates.block;

import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
Expand All @@ -15,9 +15,7 @@
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.PressurePlateBlock;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockSetType;
Expand All @@ -34,8 +32,8 @@ public class PlayerPlateBlock extends PressurePlateBlock {
public final Sensitivity sensitivity;
private boolean isInvisible;

public PlayerPlateBlock(Sensitivity sensitivity, boolean invisible, float hardness, float resistance, BlockSetType type) {
super(PressurePlateBlock.Sensitivity.EVERYTHING, BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).noCollission().strength(hardness, resistance).sound(SoundType.WOOD), type);
public PlayerPlateBlock(Sensitivity sensitivity, boolean invisible, Block copy, BlockSetType type) {
super(PressurePlateBlock.Sensitivity.EVERYTHING, BlockBehaviour.Properties.copy(copy).noCollission().sound(SoundType.WOOD), type);
this.sensitivity = sensitivity;
this.isInvisible = invisible;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"values": [
"playerplates:obsidian_plate",
"playerplates:invisible_obsidian_plate",
"playerplates:mossy_plate",
"playerplates:invisible_mossy_plate"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"playerplates:obsidian_plate",
"playerplates:invisible_obsidian_plate"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"playerplates:mossy_plate",
"playerplates:invisible_mossy_plate"
]
}

0 comments on commit 513fb23

Please sign in to comment.