mirror of
https://github.com/dragonruler1000/hdm-mod.git
synced 2025-06-29 08:29:33 -05:00
Merge pull request #1 from dragonruler1000/DEV
Working on getting a dust item added.
This commit is contained in:
commit
115a329a8f
12 changed files with 181 additions and 115 deletions
|
@ -16,7 +16,8 @@ import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
|||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import us.minecraftchest2.hdm_mod.init.ItemInit;
|
||||
import us.minecraftchest2.hdm_mod.item.ModItems;
|
||||
//import us.minecraftchest2.hdm_mod.init.ItemInit;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -30,20 +31,24 @@ public class Hdm_mod {
|
|||
|
||||
public Hdm_mod() {
|
||||
// Register the setup method for modloading
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
|
||||
IEventBus modEventBus1 = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
ModItems.register(modEventBus1);
|
||||
|
||||
modEventBus1.addListener(this::setup);
|
||||
// Register the enqueueIMC method for modloading
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
|
||||
modEventBus1.addListener(this::enqueueIMC);
|
||||
// Register the processIMC method for modloading
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC);
|
||||
modEventBus1.addListener(this::processIMC);
|
||||
// Register the doClientStuff method for modloading
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
|
||||
modEventBus1.addListener(this::doClientStuff);
|
||||
|
||||
// Register ourselves for server and other game events we are interested in
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
final IEventBus modEventBus = modEventBus1;
|
||||
|
||||
modEventBus.addListener(this::setup);
|
||||
ItemInit.ITEMS.register(modEventBus);
|
||||
//ItemInit.ITEMS.register(modEventBus);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
package us.minecraftchest2.hdm_mod.init;
|
||||
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import us.minecraftchest2.hdm_mod.Hdm_mod;
|
||||
import us.minecraftchest2.hdm_mod.util.ModItemTier;
|
||||
|
||||
public class ItemInit {
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Hdm_mod.MOD_ID);
|
||||
public static final RegistryObject<Item> KNIFE = ITEMS.register("knife", () -> new SwordItem(ModItemTier.MGTI, 3,-1f, new Item.Properties().tab(ModCreativeTab.Items)));
|
||||
public static final RegistryObject<Item> OMELET = ITEMS.register("omelet", () -> new Item(new Item.Properties().tab(ModCreativeTab.Items).food(new Food.Builder().nutrition(4).saturationMod(2).build())));
|
||||
public static final RegistryObject<Item> SPYGLASS = ITEMS.register("spyglass", () -> new Item(new Item.Properties().tab(ModCreativeTab.Items)));
|
||||
|
||||
public static class ModCreativeTab extends ItemGroup {
|
||||
public static final ModCreativeTab Items = new ModCreativeTab(ItemGroup.TABS.length, "HDM Mod Items");
|
||||
private ModCreativeTab(int index, String label) {
|
||||
super(index, label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack makeIcon() {
|
||||
return new ItemStack(KNIFE.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
26
src/main/java/us/minecraftchest2/hdm_mod/item/ModItems.java
Normal file
26
src/main/java/us/minecraftchest2/hdm_mod/item/ModItems.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
package us.minecraftchest2.hdm_mod.item;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import us.minecraftchest2.hdm_mod.Hdm_mod;
|
||||
|
||||
public class ModItems {
|
||||
|
||||
public static final DeferredRegister<Item> ITEMS =
|
||||
DeferredRegister.create(ForgeRegistries.ITEMS, Hdm_mod.MOD_ID);
|
||||
|
||||
public static final RegistryObject<Item> DUST = ITEMS.register("dust",
|
||||
() -> new Item(new Item.Properties().isImmuneToFire().maxStackSize(65).group(ItemGroup.MATERIALS)));
|
||||
|
||||
|
||||
|
||||
public static void register(IEventBus eventBus) {
|
||||
ITEMS.register(eventBus);
|
||||
}
|
||||
|
||||
|
||||
}
|
20
src/main/java/us/minecraftchest2/hdm_mod/item/SpyGlass.java
Normal file
20
src/main/java/us/minecraftchest2/hdm_mod/item/SpyGlass.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
//package us.minecraftchest2.hdm_mod.items;
|
||||
//
|
||||
//import net.minecraft.entity.player.PlayerEntity;
|
||||
//import net.minecraft.item.Item;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.util.ActionResult;
|
||||
//import net.minecraft.util.Hand;
|
||||
//import net.minecraft.world.World;
|
||||
//
|
||||
//public class SpyGlass extends Item {
|
||||
// public SpyGlass(Properties properties)
|
||||
// {
|
||||
// super(properties);
|
||||
// }
|
||||
// @Override
|
||||
// public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
|
||||
// return super.use(world, player, hand);
|
||||
// }
|
||||
//
|
||||
//}
|
|
@ -1,20 +0,0 @@
|
|||
package us.minecraftchest2.hdm_mod.items;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SpyGlass extends Item {
|
||||
public SpyGlass(Properties properties)
|
||||
{
|
||||
super(properties);
|
||||
}
|
||||
@Override
|
||||
public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
|
||||
return super.use(world, player, hand);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,54 +1,54 @@
|
|||
package us.minecraftchest2.hdm_mod.util;
|
||||
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.LazyValue;
|
||||
import us.minecraftchest2.hdm_mod.init.ItemInit;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum ModItemTier implements IItemTier {
|
||||
MGTI(4, 30000, 10.0F, 20.0F, 5, () -> {
|
||||
return Ingredient.of(ItemInit.KNIFE.get());
|
||||
});
|
||||
|
||||
private final int level;
|
||||
private final int uses;
|
||||
private final float speed;
|
||||
private final float damage;
|
||||
private final int enchantmentValue;
|
||||
private final LazyValue<Ingredient> repairIngredient;
|
||||
|
||||
ModItemTier(int level, int durability, float miningSpeed, float damage, int enchantability, Supplier<Ingredient> repairIngredient) {
|
||||
this.level = level;
|
||||
this.uses = durability;
|
||||
this.speed = miningSpeed;
|
||||
this.damage = damage;
|
||||
this.enchantmentValue = enchantability;
|
||||
this.repairIngredient = new LazyValue<>(repairIngredient);
|
||||
}
|
||||
|
||||
public int getUses() {
|
||||
return this.uses;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return this.speed;
|
||||
}
|
||||
|
||||
public float getAttackDamageBonus() {
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return this.level;
|
||||
}
|
||||
|
||||
public int getEnchantmentValue() {
|
||||
return this.enchantmentValue;
|
||||
}
|
||||
|
||||
public Ingredient getRepairIngredient() {
|
||||
return this.repairIngredient.get();
|
||||
}
|
||||
}
|
||||
//package us.minecraftchest2.hdm_mod.util;
|
||||
//
|
||||
//import net.minecraft.item.IItemTier;
|
||||
//import net.minecraft.item.crafting.Ingredient;
|
||||
//import net.minecraft.util.LazyValue;
|
||||
////import us.minecraftchest2.hdm_mod.init.ItemInit;
|
||||
//
|
||||
//import java.util.function.Supplier;
|
||||
//
|
||||
//public enum ModItemTier implements IItemTier {
|
||||
// MGTI(4, 30000, 10.0F, 20.0F, 5, () -> {
|
||||
// //return Ingredient.of(ItemInit.KNIFE.get());
|
||||
// });
|
||||
//
|
||||
// private final int level;
|
||||
// private final int uses;
|
||||
// private final float speed;
|
||||
// private final float damage;
|
||||
// private final int enchantmentValue;
|
||||
// private final LazyValue<Ingredient> repairIngredient;
|
||||
//
|
||||
// ModItemTier(int level, int durability, float miningSpeed, float damage, int enchantability, Supplier<Ingredient> repairIngredient) {
|
||||
// this.level = level;
|
||||
// this.uses = durability;
|
||||
// this.speed = miningSpeed;
|
||||
// this.damage = damage;
|
||||
// this.enchantmentValue = enchantability;
|
||||
// this.repairIngredient = new LazyValue<>(repairIngredient);
|
||||
// }
|
||||
//
|
||||
// public int getUses() {
|
||||
// return this.uses;
|
||||
// }
|
||||
//
|
||||
// public float getSpeed() {
|
||||
// return this.speed;
|
||||
// }
|
||||
//
|
||||
// public float getAttackDamageBonus() {
|
||||
// return this.damage;
|
||||
// }
|
||||
//
|
||||
// public int getLevel() {
|
||||
// return this.level;
|
||||
// }
|
||||
//
|
||||
// public int getEnchantmentValue() {
|
||||
// return this.enchantmentValue;
|
||||
// }
|
||||
//
|
||||
// public Ingredient getRepairIngredient() {
|
||||
// return this.repairIngredient.get();
|
||||
// }
|
||||
//}
|
|
@ -7,6 +7,6 @@ import net.minecraft.world.World;
|
|||
import us.minecraftchest2.hdm_mod.Hdm_mod;
|
||||
|
||||
public class ModDimensions {
|
||||
public static RegistryKey<World> TestDim = RegistryKey.createRegistryKey(Registry.WORLD_KEY,
|
||||
public static RegistryKey<World> TestDim = RegistryKey.getOrCreateKey(Registry.WORLD_KEY,
|
||||
new ResourceLocation(Hdm_mod.MOD_ID, "testdim"));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,60 @@
|
|||
package us.minecraftchest2.hdm_mod.world.dimension;
|
||||
|
||||
public class SimpleTeleporter {
|
||||
}
|
||||
//package us.minecraftchest2.hdm_mod.world.dimension;
|
||||
//
|
||||
//import net.minecraft.block.material.Material;
|
||||
//import net.minecraft.entity.Entity;
|
||||
//import net.minecraft.fluid.Fluids;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.world.server.ServerWorld;
|
||||
//import net.minecraftforge.common.util.ITeleporter;
|
||||
//import us.minecraftchest2.hdm_mod.
|
||||
//
|
||||
//import java.util.function.Function;
|
||||
//
|
||||
//public class KJTeleporter implements ITeleporter {
|
||||
// public static BlockPos thisPos = BlockPos.ZERO;
|
||||
// public static boolean insideDimension = true;
|
||||
//
|
||||
// public KJTeleporter(BlockPos pos, boolean insideDim) {
|
||||
// thisPos = pos;
|
||||
// insideDimension = insideDim;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destinationWorld,
|
||||
// float yaw, Function<Boolean, Entity> repositionEntity) {
|
||||
// entity = repositionEntity.apply(false);
|
||||
// double y = 61;
|
||||
//
|
||||
// if (!insideDimension) {
|
||||
// y = thisPos.getY();
|
||||
// }
|
||||
//
|
||||
// BlockPos destinationPos = new BlockPos(thisPos.getX(), y, thisPos.getZ());
|
||||
//
|
||||
// int tries = 0;
|
||||
// while ((destinationWorld.getBlockState(destinationPos).getMaterial() != Material.AIR) &&
|
||||
// !destinationWorld.getBlockState(destinationPos).isReplaceable(Fluids.WATER) &&
|
||||
// destinationWorld.getBlockState(destinationPos.up()).getMaterial() != Material.AIR &&
|
||||
// !destinationWorld.getBlockState(destinationPos.up()).isReplaceable(Fluids.WATER) && tries < 25) {
|
||||
// destinationPos = destinationPos.up(2);
|
||||
// tries++;
|
||||
// }
|
||||
//
|
||||
// entity.setPositionAndUpdate(destinationPos.getX(), destinationPos.getY(), destinationPos.getZ());
|
||||
//
|
||||
// if (insideDimension) {
|
||||
// boolean doSetBlock = true;
|
||||
// for (BlockPos checkPos : BlockPos.getAllInBoxMutable(destinationPos.down(10).west(10), destinationPos.up(10).east(10))) {
|
||||
// if (destinationWorld.getBlockState(checkPos).getBlock() instanceof KaupenAltarBlock) {
|
||||
// doSetBlock = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (doSetBlock) {
|
||||
// destinationWorld.setBlockState(destinationPos, ModBlocks.KAUPEN_ALTAR.get().getDefaultState());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return entity;
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
"itemGroup.hdm_mod": "HDM Mod Items",
|
||||
|
||||
"item.hdm_mod.knife": "Subtle Knife",
|
||||
"item.hdm_mod.omelet": "Omelet"
|
||||
"item.hdm_mod.omelet": "Omelet",
|
||||
"item.hdm_mod.dust": "Dust"
|
||||
}
|
6
src/main/resources/assets/hdm_mod/models/item/dust.json
Normal file
6
src/main/resources/assets/hdm_mod/models/item/dust.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "hdm_mod:item/dust"
|
||||
}
|
||||
}
|
BIN
src/main/resources/assets/hdm_mod/textures/items/dust.png
Normal file
BIN
src/main/resources/assets/hdm_mod/textures/items/dust.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 191 B |
Loading…
Add table
Add a link
Reference in a new issue