-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #907 from Tcat2000/2001-pick-block
Adds a callback to change/override the pick block result.
- Loading branch information
Showing
3 changed files
with
67 additions
and
0 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
36 changes: 36 additions & 0 deletions
36
common/src/main/java/dev/latvian/mods/kubejs/block/PickBlockCallbackJS.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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package dev.latvian.mods.kubejs.block; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
public class PickBlockCallbackJS { | ||
public BlockGetter block; | ||
public BlockPos pos; | ||
public BlockState state; | ||
public Item item; | ||
|
||
public PickBlockCallbackJS(BlockGetter blockGetter, BlockPos blockPos, BlockState blockState) { | ||
this.block = blockGetter; | ||
this.pos = blockPos; | ||
this.state = blockState; | ||
} | ||
|
||
public BlockState getState() { | ||
return this.state; | ||
} | ||
public BlockPos getBlockPos() { | ||
return this.pos; | ||
} | ||
public BlockGetter getBlockGetter() { | ||
return this.block; | ||
} | ||
public void setPickBlockItem(String item) { | ||
this.item = BuiltInRegistries.ITEM.get(new ResourceLocation(item)); | ||
} | ||
} |
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