Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba5cb6a241 | ||
|
|
dd2ce91669 | ||
|
|
0c09511fcf | ||
|
|
39bd085333 | ||
|
|
ef6d1b20c1 | ||
|
|
9d71192566 | ||
|
|
584d08d7d4 | ||
|
|
312e73f184 | ||
|
|
5c9dbe95e5 | ||
|
|
0b4936f47d | ||
|
|
96c4be6a0d | ||
|
|
0d12beb4be |
No files matched your search
@@ -41,6 +41,10 @@ run/crash-reports
|
|||||||
run/xaero
|
run/xaero
|
||||||
run/screenshots
|
run/screenshots
|
||||||
run/Xaero*
|
run/Xaero*
|
||||||
|
<<<<<<< HEAD
|
||||||
|
run/serves*
|
||||||
|
=======
|
||||||
|
>>>>>>> refs/remotes/origin/main
|
||||||
run/command_history.txt
|
run/command_history.txt
|
||||||
|
|
||||||
# java
|
# java
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package de.jottyfan.minecraft.item;
|
||||||
|
|
||||||
|
import net.minecraft.world.food.FoodProperties;
|
||||||
|
|
||||||
|
public enum Food {
|
||||||
|
GINGERBREAD(new FoodProperties.Builder().nutrition(1).saturationModifier(0.1f).build());
|
||||||
|
|
||||||
|
private final FoodProperties properties;
|
||||||
|
|
||||||
|
private Food(FoodProperties properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FoodProperties get() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.Item.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -13,17 +14,25 @@ import net.minecraft.world.item.Item;
|
|||||||
public class ModItems extends ModItemsRegistrator {
|
public class ModItems extends ModItemsRegistrator {
|
||||||
public static final Item RAW_TIN = registerItem("raw_tin");
|
public static final Item RAW_TIN = registerItem("raw_tin");
|
||||||
public static final Item RUBY = registerItem("ruby");
|
public static final Item RUBY = registerItem("ruby");
|
||||||
|
public static final Item FUTURISTIC_CROSSBOW = registerItem("futuristic_crossbow");
|
||||||
public static final Item CHILI = registerItem("chili");
|
public static final Item CHILI = registerItem("chili");
|
||||||
public static final Item STUB = registerItem("stub");
|
public static final Item STUB = registerItem("stub", StubItem::new);
|
||||||
public static final Item TIN_INGOT = registerItem("tin_ingot");
|
public static final Item TIN_INGOT = registerItem("tin_ingot");
|
||||||
|
public static final Item TIN_DUST = registerItem("tin_dust");
|
||||||
|
public static final Item GINGERBREAD = registerItem("gingerbread", new Properties().food(Food.GINGERBREAD.get()));
|
||||||
|
public static final Item SCHWERTWERFER = registerItem("schwertwerfer");
|
||||||
|
|
||||||
public static final List<Item> registerItems() {
|
public static final List<Item> registerItems() {
|
||||||
List<Item> registeredItems = new ArrayList<>();
|
List<Item> registeredItems = new ArrayList<>();
|
||||||
registeredItems.add(STUB);
|
registeredItems.add(STUB);
|
||||||
registeredItems.add(RUBY);
|
registeredItems.add(RUBY);
|
||||||
|
registeredItems.add(FUTURISTIC_CROSSBOW);
|
||||||
registeredItems.add(CHILI);
|
registeredItems.add(CHILI);
|
||||||
registeredItems.add(RAW_TIN);
|
registeredItems.add(RAW_TIN);
|
||||||
registeredItems.add(TIN_INGOT);
|
registeredItems.add(TIN_INGOT);
|
||||||
|
registeredItems.add(TIN_DUST);
|
||||||
|
registeredItems.add(GINGERBREAD);
|
||||||
|
registeredItems.add(SCHWERTWERFER);
|
||||||
return registeredItems;
|
return registeredItems;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,12 +28,34 @@ public abstract class ModItemsRegistrator {
|
|||||||
return registerItem(name, new Item.Properties(), Item::new);
|
return registerItem(name, new Item.Properties(), Item::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* register a new item with the name and its item class
|
||||||
|
*
|
||||||
|
* @param name the name
|
||||||
|
* @param properties the properties; create it with <code style="color: gray">new Item.Properties();</code>
|
||||||
|
* @return the registered item
|
||||||
|
*/
|
||||||
|
public static final Item registerItem(String name, Properties properties) {
|
||||||
|
return registerItem(name, properties, Item::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* register a new item with the name and its properties
|
||||||
|
*
|
||||||
|
* @param name the name
|
||||||
|
* @param function the function; create it with <code style="color: gray">Item::new</code>
|
||||||
|
* @return the registered item
|
||||||
|
*/
|
||||||
|
public static final Item registerItem(String name, Function<Item.Properties, Item> function) {
|
||||||
|
return registerItem(name, new Item.Properties(), function);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* register a new item with the name, the properties and the Item class reference
|
* register a new item with the name, the properties and the Item class reference
|
||||||
*
|
*
|
||||||
* @param name the name of the item
|
* @param name the name of the item
|
||||||
* @param the properties; create it with <code style="color: gray">new Item.Properties();</code>
|
* @param properties the properties; create it with <code style="color: gray">new Item.Properties();</code>
|
||||||
* @param the function; create it with <code style="color: gray">Item::new</code>
|
* @param function the function; create it with <code style="color: gray">Item::new</code>
|
||||||
* @return the registered item
|
* @return the registered item
|
||||||
*/
|
*/
|
||||||
public static final Item registerItem(String name, Properties properties, Function<Item.Properties, Item> function) {
|
public static final Item registerItem(String name, Properties properties, Function<Item.Properties, Item> function) {
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package de.jottyfan.minecraft.item;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.joml.Random;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.sounds.SoundEvents;
|
||||||
|
import net.minecraft.sounds.SoundSource;
|
||||||
|
import net.minecraft.world.InteractionResult;
|
||||||
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.item.context.UseOnContext;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the stub item definition; specifies, what the stub can do
|
||||||
|
*/
|
||||||
|
public class StubItem extends Item {
|
||||||
|
private static final Map<Block, Item> SLASH_MAP = Map.of(Blocks.HAY_BLOCK, Items.WHEAT, Blocks.DRIED_KELP_BLOCK,
|
||||||
|
Items.DRIED_KELP);
|
||||||
|
|
||||||
|
public StubItem(Properties properties) {
|
||||||
|
super(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InteractionResult useOn(UseOnContext context) {
|
||||||
|
Level level = context.getLevel();
|
||||||
|
BlockPos pos = context.getClickedPos();
|
||||||
|
Block block = level.getBlockState(pos).getBlock();
|
||||||
|
if (SLASH_MAP.containsKey(block) && !level.isClientSide()) {
|
||||||
|
level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState());
|
||||||
|
level.playSound(null, pos, SoundEvents.HOE_TILL.value(), SoundSource.BLOCKS);
|
||||||
|
for (int i = 0; i < 9; i++) {
|
||||||
|
ItemStack stack = new ItemStack(SLASH_MAP.get(block));
|
||||||
|
float scatter = new Random().nextFloat();
|
||||||
|
ItemEntity entity = new ItemEntity(level, pos.getX(), pos.getY(), pos.getZ(),
|
||||||
|
stack, scatter, scatter, 0.2);
|
||||||
|
level.addFreshEntity(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return InteractionResult.SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"model":{
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "minecraft:item/futuristic_crossbow"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"model": {
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "mfmd2627:item/gingerbread"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"model": {
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "mfmd2627:item/schwertwerfer"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"model": {
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "mfmd2627:item/tin_dust"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
{
|
{
|
||||||
|
"item.mfmd2627.gingerbread": "Lebkuchen",
|
||||||
"item.mfmd2627.stub": "Stummel",
|
"item.mfmd2627.stub": "Stummel",
|
||||||
"item.mfmd2627.raw_tin": "Zinn",
|
"item.mfmd2627.raw_tin": "Zinn",
|
||||||
"item.mfmd2627.ruby": "Rubin",
|
"item.mfmd2627.ruby": "Rubin",
|
||||||
|
"item.mfmd2627.futuristic_crossbow": "futuristische Armbrust",
|
||||||
|
"item.mfmd2627.tin_dust": "Zinnpulver",
|
||||||
"item.mfmd2627.tin_ingot": "Zinnbarren",
|
"item.mfmd2627.tin_ingot": "Zinnbarren",
|
||||||
"item.mfmd2627.tin_ore": "Zinnerz",
|
"item.mfmd2627.tin_ore": "Zinnerz",
|
||||||
"tab.mfmd2627": "Mfmd2627"
|
"tab.mfmd2627": "Mfmd2627",
|
||||||
}
|
"item.mfmd2627.schwertwerfer": "Schwertwerfer"
|
||||||
|
}
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
{
|
{
|
||||||
|
"item.mfmd2627.gingerbread": "Gingerbread",
|
||||||
"item.mfmd2627.stub": "Stub",
|
"item.mfmd2627.stub": "Stub",
|
||||||
"item.mfmd2627.raw_tin": "Tin",
|
"item.mfmd2627.raw_tin": "Tin",
|
||||||
"item.mfmd2627.ruby": "Ruby",
|
"item.mfmd2627.ruby": "Ruby",
|
||||||
|
"item.mfmd2627.futuristic_crossbow": "Futuristic Crossbow",
|
||||||
|
"item.mfmd2627.tin_dust": "Tin Dust",
|
||||||
"item.mfmd2627.tin_ingot": "Tin Ingot",
|
"item.mfmd2627.tin_ingot": "Tin Ingot",
|
||||||
"item.mfmd2627.tin_ore": "Tin Ore",
|
"item.mfmd2627.tin_ore": "Tin Ore",
|
||||||
"tab.mfmd2627": "Mfmd2627"
|
"tab.mfmd2627": "Mfmd2627",
|
||||||
}
|
"item.mfmd2627.schwertwerfer": "Sword Thrower"
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "mfmd2627:item/futuristic_crossbow"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "mfmd2627:item/gingerbread"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "mfmd2627:item/schwertwerfer"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "mfmd2627:item/tin_dust"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 722 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 478 B |
|
After Width: | Height: | Size: 276 B |
|
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 303 B |
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"mfmd2627:gingerbread"
|
||||||
|
]
|
||||||
|
}
|
||||||