Port from EverythingVanilla
TODO: make enchanted apples glow, add ore gen, daggers, golden netherite, villager meat, vertical slabs, aether, reaplant/replenish enchantment.
This commit is contained in:
24
src/main/java/tech/nevets/vplus/Main.java
Normal file
24
src/main/java/tech/nevets/vplus/Main.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package tech.nevets.vplus;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import tech.nevets.vplus.armor.VPArmor;
|
||||
import tech.nevets.vplus.blocks.VPBlocks;
|
||||
import tech.nevets.vplus.food.VPFood;
|
||||
import tech.nevets.vplus.items.VPItems;
|
||||
import tech.nevets.vplus.misc.VPFuels;
|
||||
import tech.nevets.vplus.misc.VPZoom;
|
||||
import tech.nevets.vplus.tools.VPTools;
|
||||
|
||||
public class Main implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
VPBlocks.vpBlocks();
|
||||
VPItems.vpItems();
|
||||
VPFood.vpFood();
|
||||
VPTools.vpTools();
|
||||
VPArmor.vpArmor();
|
||||
VPFuels.vpFuels();
|
||||
VPZoom.vpZoom();
|
||||
}
|
||||
}
|
||||
81
src/main/java/tech/nevets/vplus/armor/ArmorMaterials.java
Normal file
81
src/main/java/tech/nevets/vplus/armor/ArmorMaterials.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package tech.nevets.vplus.armor;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.item.ArmorMaterial;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.Lazy;
|
||||
import tech.nevets.vplus.items.VPItems;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum ArmorMaterials implements ArmorMaterial {
|
||||
EMERALD("emerald", 30, new int[]{2, 6, 8, 2}, 30, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, 0.0F, () -> {
|
||||
return Ingredient.ofItems(new ItemConvertible[]{Items.EMERALD});
|
||||
}),
|
||||
PLATINUM("platinum", 40, new int[]{6, 8, 10, 6}, 40, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, 0.5F, () -> {
|
||||
return Ingredient.ofItems(new ItemConvertible[]{VPItems.PLATINUMINGOT});
|
||||
}),
|
||||
RUBY("ruby", 75, new int[]{10, 15, 20, 10}, 100, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 4.0F, 1.0F, () -> {
|
||||
return Ingredient.ofItems(new ItemConvertible[]{VPItems.RUBY});
|
||||
});
|
||||
|
||||
private static final int[] BASE_DURABILITY = new int[]{13, 15, 16, 11};
|
||||
private final String name;
|
||||
private final int durabilityMultiplier;
|
||||
private final int[] protectionAmounts;
|
||||
private final int enchantability;
|
||||
private final SoundEvent equipSound;
|
||||
private final float toughness;
|
||||
private final float knockbackResistance;
|
||||
private final Lazy<Ingredient> repairIngredientSupplier;
|
||||
|
||||
private ArmorMaterials(String name, int durabilityMultiplier, int[] protectionAmounts, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Supplier<Ingredient> repairIngredientSupplier) {
|
||||
this.name = name;
|
||||
this.durabilityMultiplier = durabilityMultiplier;
|
||||
this.protectionAmounts = protectionAmounts;
|
||||
this.enchantability = enchantability;
|
||||
this.equipSound = equipSound;
|
||||
this.toughness = toughness;
|
||||
this.knockbackResistance = knockbackResistance;
|
||||
this.repairIngredientSupplier = new Lazy(repairIngredientSupplier);
|
||||
}
|
||||
|
||||
public int getDurability(EquipmentSlot slot) {
|
||||
return BASE_DURABILITY[slot.getEntitySlotId()] * this.durabilityMultiplier;
|
||||
}
|
||||
|
||||
public int getProtectionAmount(EquipmentSlot slot) {
|
||||
return this.protectionAmounts[slot.getEntitySlotId()];
|
||||
}
|
||||
|
||||
public int getEnchantability() {
|
||||
return this.enchantability;
|
||||
}
|
||||
|
||||
public SoundEvent getEquipSound() {
|
||||
return this.equipSound;
|
||||
}
|
||||
|
||||
public Ingredient getRepairIngredient() {
|
||||
return (Ingredient)this.repairIngredientSupplier.get();
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public float getToughness() {
|
||||
return this.toughness;
|
||||
}
|
||||
|
||||
public float getKnockbackResistance() {
|
||||
return this.knockbackResistance;
|
||||
}
|
||||
}
|
||||
12
src/main/java/tech/nevets/vplus/armor/BaseArmor.java
Normal file
12
src/main/java/tech/nevets/vplus/armor/BaseArmor.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package tech.nevets.vplus.armor;
|
||||
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.ArmorMaterial;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class BaseArmor extends ArmorItem {
|
||||
public BaseArmor(ArmorMaterial material, EquipmentSlot slot) {
|
||||
super(material, slot, new Settings().group(VPItemGroups.COMBAT));
|
||||
}
|
||||
}
|
||||
44
src/main/java/tech/nevets/vplus/armor/VPArmor.java
Normal file
44
src/main/java/tech/nevets/vplus/armor/VPArmor.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package tech.nevets.vplus.armor;
|
||||
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.item.ArmorMaterial;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class VPArmor {
|
||||
|
||||
public static final ArmorMaterial EMERALD_ARMOR = ArmorMaterials.EMERALD;
|
||||
public static final ArmorMaterial PLATINUM_ARMOR = ArmorMaterials.PLATINUM;
|
||||
public static final ArmorMaterial RUBY_ARMOR = ArmorMaterials.RUBY;
|
||||
|
||||
public static void vpArmor() {
|
||||
initializeHelmet();
|
||||
initializeChestplates();
|
||||
initialzeLeggings();
|
||||
initializeBoots();
|
||||
}
|
||||
|
||||
public static void initializeHelmet() {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "emerald_helmet"), new BaseArmor(EMERALD_ARMOR, EquipmentSlot.HEAD));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_helmet"), new BaseArmor(PLATINUM_ARMOR, EquipmentSlot.HEAD));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby_helmet"), new BaseArmor(RUBY_ARMOR, EquipmentSlot.HEAD));
|
||||
}
|
||||
|
||||
public static void initializeChestplates() {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "emerald_chestplate"), new BaseArmor(EMERALD_ARMOR, EquipmentSlot.CHEST));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_chestplate"), new BaseArmor(PLATINUM_ARMOR, EquipmentSlot.CHEST));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby_chestplate"), new BaseArmor(RUBY_ARMOR, EquipmentSlot.CHEST));
|
||||
}
|
||||
|
||||
public static void initialzeLeggings() {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "emerald_leggings"), new BaseArmor(EMERALD_ARMOR, EquipmentSlot.LEGS));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_leggings"), new BaseArmor(PLATINUM_ARMOR, EquipmentSlot.LEGS));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby_leggings"), new BaseArmor(RUBY_ARMOR, EquipmentSlot.LEGS));
|
||||
}
|
||||
|
||||
public static void initializeBoots() {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "emerald_boots"), new BaseArmor(EMERALD_ARMOR, EquipmentSlot.FEET));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_boots"), new BaseArmor(PLATINUM_ARMOR, EquipmentSlot.FEET));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby_boots"), new BaseArmor(RUBY_ARMOR, EquipmentSlot.FEET));
|
||||
}
|
||||
}
|
||||
46
src/main/java/tech/nevets/vplus/blocks/ColorTorchBlock.java
Normal file
46
src/main/java/tech/nevets/vplus/blocks/ColorTorchBlock.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package tech.nevets.vplus.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.particle.ParticleEffect;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
|
||||
public class ColorTorchBlock extends Block {
|
||||
protected static final int field_31265 = 2;
|
||||
protected static final VoxelShape BOUNDING_SHAPE = Block.createCuboidShape(6.0D, 0.0D, 6.0D, 10.0D, 10.0D, 10.0D);
|
||||
protected final ParticleEffect particle;
|
||||
|
||||
|
||||
public ColorTorchBlock(Settings settings, ParticleEffect particle) {
|
||||
super(settings);
|
||||
this.particle = particle;
|
||||
}
|
||||
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
return BOUNDING_SHAPE;
|
||||
}
|
||||
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
|
||||
return direction == Direction.DOWN && !this.canPlaceAt(state, world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
|
||||
}
|
||||
|
||||
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
|
||||
return sideCoversSmallSquare(world, pos.down(), Direction.UP);
|
||||
}
|
||||
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
||||
double d = (double)pos.getX() + 0.5D;
|
||||
double e = (double)pos.getY() + 0.7D;
|
||||
double f = (double)pos.getZ() + 0.5D;
|
||||
world.addParticle(ParticleTypes.SMOKE, d, e, f, 0.0D, 0.0D, 0.0D);
|
||||
world.addParticle(this.particle, d, e, f, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
110
src/main/java/tech/nevets/vplus/blocks/ColorWallTorchBlock.java
Normal file
110
src/main/java/tech/nevets/vplus/blocks/ColorWallTorchBlock.java
Normal file
@@ -0,0 +1,110 @@
|
||||
package tech.nevets.vplus.blocks;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.particle.ParticleEffect;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.util.BlockMirror;
|
||||
import net.minecraft.util.BlockRotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class ColorWallTorchBlock extends TorchBlock {
|
||||
public static final DirectionProperty FACING;
|
||||
protected static final float field_31285 = 2.5F;
|
||||
private static final Map<Direction, VoxelShape> BOUNDING_SHAPES;
|
||||
|
||||
protected ColorWallTorchBlock(Settings settings, ParticleEffect particleEffect) {
|
||||
super(settings, particleEffect);
|
||||
this.setDefaultState((BlockState)((BlockState)this.stateManager.getDefaultState()).with(FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
public String getTranslationKey() {
|
||||
return this.asItem().getTranslationKey();
|
||||
}
|
||||
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
return getBoundingShape(state);
|
||||
}
|
||||
|
||||
public static VoxelShape getBoundingShape(BlockState state) {
|
||||
return (VoxelShape)BOUNDING_SHAPES.get(state.get(FACING));
|
||||
}
|
||||
|
||||
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
|
||||
Direction direction = (Direction)state.get(FACING);
|
||||
BlockPos blockPos = pos.offset(direction.getOpposite());
|
||||
BlockState blockState = world.getBlockState(blockPos);
|
||||
return blockState.isSideSolidFullSquare(world, blockPos, direction);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||
BlockState blockState = this.getDefaultState();
|
||||
WorldView worldView = ctx.getWorld();
|
||||
BlockPos blockPos = ctx.getBlockPos();
|
||||
Direction[] directions = ctx.getPlacementDirections();
|
||||
Direction[] var6 = directions;
|
||||
int var7 = directions.length;
|
||||
|
||||
for(int var8 = 0; var8 < var7; ++var8) {
|
||||
Direction direction = var6[var8];
|
||||
if (direction.getAxis().isHorizontal()) {
|
||||
Direction direction2 = direction.getOpposite();
|
||||
blockState = (BlockState)blockState.with(FACING, direction2);
|
||||
if (blockState.canPlaceAt(worldView, blockPos)) {
|
||||
return blockState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
|
||||
return direction.getOpposite() == state.get(FACING) && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : state;
|
||||
}
|
||||
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
||||
Direction direction = (Direction)state.get(FACING);
|
||||
double d = (double)pos.getX() + 0.5D;
|
||||
double e = (double)pos.getY() + 0.7D;
|
||||
double f = (double)pos.getZ() + 0.5D;
|
||||
double g = 0.22D;
|
||||
double h = 0.27D;
|
||||
Direction direction2 = direction.getOpposite();
|
||||
world.addParticle(ParticleTypes.SMOKE, d + 0.27D * (double)direction2.getOffsetX(), e + 0.22D, f + 0.27D * (double)direction2.getOffsetZ(), 0.0D, 0.0D, 0.0D);
|
||||
world.addParticle(this.particle, d + 0.27D * (double)direction2.getOffsetX(), e + 0.22D, f + 0.27D * (double)direction2.getOffsetZ(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
public BlockState rotate(BlockState state, BlockRotation rotation) {
|
||||
return (BlockState)state.with(FACING, rotation.rotate((Direction)state.get(FACING)));
|
||||
}
|
||||
|
||||
public BlockState mirror(BlockState state, BlockMirror mirror) {
|
||||
return state.rotate(mirror.getRotation((Direction)state.get(FACING)));
|
||||
}
|
||||
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
builder.add(new Property[]{FACING});
|
||||
}
|
||||
|
||||
static {
|
||||
FACING = HorizontalFacingBlock.FACING;
|
||||
BOUNDING_SHAPES = Maps.newEnumMap(ImmutableMap.of(Direction.NORTH, Block.createCuboidShape(5.5D, 3.0D, 11.0D, 10.5D, 13.0D, 16.0D), Direction.SOUTH, Block.createCuboidShape(5.5D, 3.0D, 0.0D, 10.5D, 13.0D, 5.0D), Direction.WEST, Block.createCuboidShape(11.0D, 3.0D, 5.5D, 16.0D, 13.0D, 10.5D), Direction.EAST, Block.createCuboidShape(0.0D, 3.0D, 5.5D, 5.0D, 13.0D, 10.5D)));
|
||||
}
|
||||
}
|
||||
81
src/main/java/tech/nevets/vplus/blocks/LavaSpongeBlock.java
Normal file
81
src/main/java/tech/nevets/vplus/blocks/LavaSpongeBlock.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package tech.nevets.vplus.blocks;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.tag.FluidTags;
|
||||
import net.minecraft.util.Pair;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Queue;
|
||||
|
||||
public class LavaSpongeBlock extends Block {
|
||||
|
||||
|
||||
public LavaSpongeBlock() {
|
||||
super(FabricBlockSettings.of(Material.STONE).strength(0.6F).sounds(BlockSoundGroup.BASALT));
|
||||
}
|
||||
|
||||
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||
if (!oldState.isOf(state.getBlock())) {
|
||||
this.update(world, pos);
|
||||
}
|
||||
}
|
||||
|
||||
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) {
|
||||
this.update(world, pos);
|
||||
super.neighborUpdate(state, world, pos, block, fromPos, notify);
|
||||
}
|
||||
|
||||
protected void update(World world, BlockPos pos) {
|
||||
if (this.absorbLava(world, pos)) {
|
||||
world.setBlockState(pos, VPBlocks.SATURATEDLAVASPONGEBLOCK.getDefaultState(), 2);
|
||||
world.syncWorldEvent(2001, pos, Block.getRawIdFromState(Blocks.LAVA.getDefaultState()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean absorbLava(World world, BlockPos pos) {
|
||||
Queue<Pair<BlockPos, Integer>> queue = Lists.newLinkedList();
|
||||
queue.add(new Pair(pos, 0));
|
||||
int i = 0;
|
||||
|
||||
while(!queue.isEmpty()) {
|
||||
Pair<BlockPos, Integer> pair = (Pair)queue.poll();
|
||||
BlockPos blockPos = (BlockPos)pair.getLeft();
|
||||
int j = (Integer)pair.getRight();
|
||||
Direction[] var8 = Direction.values();
|
||||
int var9 = var8.length;
|
||||
|
||||
for(int var10 = 0; var10 < var9; ++var10) {
|
||||
Direction direction = var8[var10];
|
||||
BlockPos blockPos2 = blockPos.offset(direction);
|
||||
BlockState blockState = world.getBlockState(blockPos2);
|
||||
FluidState fluidState = world.getFluidState(blockPos2);
|
||||
Material material = blockState.getMaterial();
|
||||
if (fluidState.isIn(FluidTags.LAVA)) {
|
||||
if (blockState.getBlock() instanceof FluidDrainable && !((FluidDrainable)blockState.getBlock()).tryDrainFluid(world, blockPos2, blockState).isEmpty()) {
|
||||
++i;
|
||||
if (j < 6) {
|
||||
queue.add(new Pair(blockPos2, j + 1));
|
||||
}
|
||||
} else if (blockState.getBlock() instanceof FluidBlock) {
|
||||
world.setBlockState(blockPos2, Blocks.AIR.getDefaultState(), 3);
|
||||
++i;
|
||||
if (j < 6) {
|
||||
queue.add(new Pair(blockPos2, j + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i > 64) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i > 0;
|
||||
}
|
||||
}
|
||||
13
src/main/java/tech/nevets/vplus/blocks/PlatinumBlock.java
Normal file
13
src/main/java/tech/nevets/vplus/blocks/PlatinumBlock.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
|
||||
public class PlatinumBlock extends Block {
|
||||
public PlatinumBlock() {
|
||||
super(FabricBlockSettings.of(Material.STONE).breakByHand(false).breakByTool(FabricToolTags.PICKAXES).sounds(BlockSoundGroup.METAL).strength(30, 1000f));
|
||||
}
|
||||
}
|
||||
36
src/main/java/tech/nevets/vplus/blocks/PlatinumOre.java
Normal file
36
src/main/java/tech/nevets/vplus/blocks/PlatinumOre.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package tech.nevets.vplus.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class PlatinumOre extends Block {
|
||||
public PlatinumOre() {
|
||||
super(FabricBlockSettings.of(Material.STONE).breakByTool(FabricToolTags.PICKAXES, 3).sounds(BlockSoundGroup.STONE).strength(3, 1500f));
|
||||
}
|
||||
protected int getExperienceWhenMined(Random random) {
|
||||
return MathHelper.nextInt(random, 3, 7);
|
||||
}
|
||||
|
||||
public void onStacksDropped(BlockState state, ServerWorld world, BlockPos pos, ItemStack stack) {
|
||||
super.onStacksDropped(state, world, pos, stack);
|
||||
if (EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stack) == 0) {
|
||||
int i = this.getExperienceWhenMined(world.random);
|
||||
if (i > 0) {
|
||||
this.dropExperience(world, pos, i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
13
src/main/java/tech/nevets/vplus/blocks/RubyBlock.java
Normal file
13
src/main/java/tech/nevets/vplus/blocks/RubyBlock.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
|
||||
public class RubyBlock extends Block {
|
||||
public RubyBlock() {
|
||||
super(FabricBlockSettings.of(Material.STONE).breakByHand(false).breakByTool(FabricToolTags.PICKAXES).sounds(BlockSoundGroup.METAL).strength(5, 6.0f));
|
||||
}
|
||||
}
|
||||
35
src/main/java/tech/nevets/vplus/blocks/RubyOre.java
Normal file
35
src/main/java/tech/nevets/vplus/blocks/RubyOre.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package tech.nevets.vplus.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class RubyOre extends Block {
|
||||
public RubyOre() {
|
||||
super(FabricBlockSettings.of(Material.STONE).breakByTool(FabricToolTags.PICKAXES, 3).sounds(BlockSoundGroup.STONE).strength(3, 1500f));
|
||||
}
|
||||
protected int getExperienceWhenMined(Random random) {
|
||||
return MathHelper.nextInt(random, 3, 7);
|
||||
}
|
||||
|
||||
public void onStacksDropped(BlockState state, ServerWorld world, BlockPos pos, ItemStack stack) {
|
||||
super.onStacksDropped(state, world, pos, stack);
|
||||
if (EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stack) == 0) {
|
||||
int i = this.getExperienceWhenMined(world.random);
|
||||
if (i > 0) {
|
||||
this.dropExperience(world, pos, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package tech.nevets.vplus.blocks;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SaturatedLavaSpongeBlock extends Block {
|
||||
|
||||
public SaturatedLavaSpongeBlock() {
|
||||
super(FabricBlockSettings.of(Material.STONE).strength(0.6F).sounds(BlockSoundGroup.BASALT));
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
||||
Direction direction = Direction.random(random);
|
||||
if (direction != Direction.UP) {
|
||||
BlockPos blockPos = pos.offset(direction);
|
||||
BlockState blockState = world.getBlockState(blockPos);
|
||||
if (!state.isOpaque() || !blockState.isSideSolidFullSquare(world, blockPos, direction.getOpposite())) {
|
||||
double d = (double)pos.getX();
|
||||
double e = (double)pos.getY();
|
||||
double f = (double)pos.getZ();
|
||||
if (direction == Direction.DOWN) {
|
||||
e -= 0.05D;
|
||||
d += random.nextDouble();
|
||||
f += random.nextDouble();
|
||||
} else {
|
||||
e += random.nextDouble() * 0.8D;
|
||||
if (direction.getAxis() == Direction.Axis.X) {
|
||||
f += random.nextDouble();
|
||||
if (direction == Direction.EAST) {
|
||||
++d;
|
||||
} else {
|
||||
d += 0.05D;
|
||||
}
|
||||
} else {
|
||||
d += random.nextDouble();
|
||||
if (direction == Direction.SOUTH) {
|
||||
++f;
|
||||
} else {
|
||||
f += 0.05D;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world.addParticle(ParticleTypes.DRIPPING_LAVA, d, e, f, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
49
src/main/java/tech/nevets/vplus/blocks/VPBlocks.java
Normal file
49
src/main/java/tech/nevets/vplus/blocks/VPBlocks.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package tech.nevets.vplus.blocks;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class VPBlocks {
|
||||
|
||||
public static final Block LAVASPONGEBLOCK = new LavaSpongeBlock();
|
||||
public static final Block SATURATEDLAVASPONGEBLOCK = new SaturatedLavaSpongeBlock();
|
||||
public static final Block PLATINUMORE = new PlatinumOre();
|
||||
public static final Block PLATINUMBLOCK = new PlatinumBlock();
|
||||
public static final Block RUBYBLOCK = new RubyBlock();
|
||||
public static final Block RUBYORE = new RubyOre();
|
||||
|
||||
public static void vpBlocks() {
|
||||
initializeBlocks();
|
||||
initializeBlockItems();
|
||||
initializeTorches();
|
||||
}
|
||||
|
||||
public static void initializeBlocks() {
|
||||
Registry.register(Registry.BLOCK, new Identifier("vplus", "lava_sponge"), LAVASPONGEBLOCK);
|
||||
Registry.register(Registry.BLOCK, new Identifier("vplus", "saturated_lava_sponge"), SATURATEDLAVASPONGEBLOCK);
|
||||
Registry.register(Registry.BLOCK, new Identifier("vplus", "platinum_ore"), PLATINUMORE);
|
||||
Registry.register(Registry.BLOCK, new Identifier("vplus", "platinum_block"), PLATINUMBLOCK);
|
||||
Registry.register(Registry.BLOCK, new Identifier("vplus", "ruby_block"), RUBYBLOCK);
|
||||
Registry.register(Registry.BLOCK, new Identifier("vplus", "ruby_ore"), RUBYORE);
|
||||
}
|
||||
|
||||
public static void initializeBlockItems() {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "lava_sponge"), new BlockItem(LAVASPONGEBLOCK, new Item.Settings().group(VPItemGroups.ALL)));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "saturated_lava_sponge"), new BlockItem(SATURATEDLAVASPONGEBLOCK, new Item.Settings().group(VPItemGroups.ALL).recipeRemainder(Item.fromBlock(VPBlocks.LAVASPONGEBLOCK))));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_ore"), new BlockItem(PLATINUMORE, new Item.Settings().group(VPItemGroups.ALL)));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_block"), new BlockItem(PLATINUMBLOCK, new Item.Settings().group(VPItemGroups.ALL)));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby_block"), new BlockItem(RUBYBLOCK, new Item.Settings().group(VPItemGroups.ALL)));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby_ore"), new BlockItem(RUBYORE, new Item.Settings().group(VPItemGroups.ALL)));
|
||||
}
|
||||
|
||||
public static void initializeTorches() {
|
||||
Registry.register(Registry.BLOCK, new Identifier("vplus", "green_torch"), new ColorTorchBlock(AbstractBlock.Settings.of(Material.DECORATION).noCollision().breakInstantly().luminance((state) -> {return 14;}).sounds(BlockSoundGroup.WOOD), ParticleTypes.FLAME));
|
||||
Registry.register(Registry.BLOCK, new Identifier("vplus", "green_wall_torch"), new ColorWallTorchBlock(AbstractBlock.Settings.of(Material.DECORATION).noCollision().breakInstantly().luminance((state) -> {return 14;}).sounds(BlockSoundGroup.WOOD).dropsLike(Blocks.TORCH), ParticleTypes.FLAME));
|
||||
}
|
||||
}
|
||||
13
src/main/java/tech/nevets/vplus/food/DiamondApple.java
Normal file
13
src/main/java/tech/nevets/vplus/food/DiamondApple.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class DiamondApple extends Item {
|
||||
public DiamondApple() {
|
||||
super(new Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(8).saturationModifier(14).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 3),1f).build()));
|
||||
}
|
||||
}
|
||||
13
src/main/java/tech/nevets/vplus/food/EmeraldApple.java
Normal file
13
src/main/java/tech/nevets/vplus/food/EmeraldApple.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class EmeraldApple extends Item {
|
||||
public EmeraldApple() {
|
||||
super(new Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(12).saturationModifier(16).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 5),1f).build()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class EnchantedDiamondApple extends Item {
|
||||
public EnchantedDiamondApple() {
|
||||
super(new Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(8).saturationModifier(14).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 4),1f).build()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class EnchantedEmeraldApple extends Item {
|
||||
public EnchantedEmeraldApple() {
|
||||
super(new Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(12).saturationModifier(16).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 6),1f).build()));
|
||||
}
|
||||
}
|
||||
13
src/main/java/tech/nevets/vplus/food/EnchantedIronApple.java
Normal file
13
src/main/java/tech/nevets/vplus/food/EnchantedIronApple.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class EnchantedIronApple extends Item {
|
||||
public EnchantedIronApple() {
|
||||
super(new Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class EnchantedNetheriteApple extends Item {
|
||||
public EnchantedNetheriteApple() {
|
||||
super(new Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(14).saturationModifier(18).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 8),1f).build()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class EnchantedPlatinumApple extends Item {
|
||||
public EnchantedPlatinumApple() {
|
||||
super(new Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(16).saturationModifier(20).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 10),1f).build()));
|
||||
}
|
||||
}
|
||||
13
src/main/java/tech/nevets/vplus/food/EnchantedRubyApple.java
Normal file
13
src/main/java/tech/nevets/vplus/food/EnchantedRubyApple.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class EnchantedRubyApple extends Item {
|
||||
public EnchantedRubyApple() {
|
||||
super(new Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(18).saturationModifier(22).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 12),1f).build()));
|
||||
}
|
||||
}
|
||||
13
src/main/java/tech/nevets/vplus/food/IronApple.java
Normal file
13
src/main/java/tech/nevets/vplus/food/IronApple.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class IronApple extends Item {
|
||||
public IronApple() {
|
||||
super(new Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 1),1f).build()));
|
||||
}
|
||||
}
|
||||
13
src/main/java/tech/nevets/vplus/food/NetheriteApple.java
Normal file
13
src/main/java/tech/nevets/vplus/food/NetheriteApple.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class NetheriteApple extends Item {
|
||||
public NetheriteApple() {
|
||||
super(new Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(14).saturationModifier(18).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 7),1f).build()));
|
||||
}
|
||||
}
|
||||
13
src/main/java/tech/nevets/vplus/food/PlatinumApple.java
Normal file
13
src/main/java/tech/nevets/vplus/food/PlatinumApple.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class PlatinumApple extends Item {
|
||||
public PlatinumApple() {
|
||||
super(new Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(16).saturationModifier(20).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 9),1f).build()));
|
||||
}
|
||||
}
|
||||
13
src/main/java/tech/nevets/vplus/food/RubyApple.java
Normal file
13
src/main/java/tech/nevets/vplus/food/RubyApple.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.Item;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class RubyApple extends Item {
|
||||
public RubyApple() {
|
||||
super(new Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(18).saturationModifier(22).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 11),1f).build()));
|
||||
}
|
||||
}
|
||||
41
src/main/java/tech/nevets/vplus/food/VPFood.java
Normal file
41
src/main/java/tech/nevets/vplus/food/VPFood.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package tech.nevets.vplus.food;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class VPFood {
|
||||
|
||||
public static final Item IRONAPPLE = new IronApple();
|
||||
public static final Item ENCHANTEDIRONAPPLE = new EnchantedIronApple();
|
||||
public static final Item DIAMONDAPPLE = new DiamondApple();
|
||||
public static final Item ENCHANTEDDIAMONDAPPLE = new EnchantedDiamondApple();
|
||||
public static final Item EMERALDAPPLE = new EmeraldApple();
|
||||
public static final Item ENCHANTEDEMERALDAPPLE = new EnchantedEmeraldApple();
|
||||
public static final Item NETHERITEAPPLE = new NetheriteApple();
|
||||
public static final Item ENCHANTEDNETHERITEAPPLE = new EnchantedNetheriteApple();
|
||||
public static final Item PLATINUMAPPLE = new PlatinumApple();
|
||||
public static final Item ENCHANTEDPLATINUMAPPLE = new EnchantedPlatinumApple();
|
||||
public static final Item RUBYAPPLE = new RubyApple();
|
||||
public static final Item ENCHANTEDRUBYAPPLE = new EnchantedRubyApple();
|
||||
|
||||
public static void vpFood() {
|
||||
initializeApples();
|
||||
}
|
||||
|
||||
//TODO Balance apple strengths
|
||||
public static void initializeApples() {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "iron_apple"), IRONAPPLE);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "enchanted_iron_apple"), ENCHANTEDIRONAPPLE);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "diamond_apple"), DIAMONDAPPLE);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "enchanted_diamond_apple"), ENCHANTEDDIAMONDAPPLE);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "emerald_apple"), EMERALDAPPLE);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "enchanted_emerald_apple"), ENCHANTEDEMERALDAPPLE);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "netherite_apple"), NETHERITEAPPLE);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "enchanted_netherite_apple"), ENCHANTEDNETHERITEAPPLE);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_apple"), PLATINUMAPPLE);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "enchanted_platinum_apple"), ENCHANTEDPLATINUMAPPLE);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby_apple"), RUBYAPPLE);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "enchanted_ruby_apple"), ENCHANTEDRUBYAPPLE);
|
||||
}
|
||||
}
|
||||
2
src/main/java/tech/nevets/vplus/init/ZoomInit.java
Normal file
2
src/main/java/tech/nevets/vplus/init/ZoomInit.java
Normal file
@@ -0,0 +1,2 @@
|
||||
package tech.nevets.vplus.init;public class ZoomInit {
|
||||
}
|
||||
9
src/main/java/tech/nevets/vplus/items/PlatinumIngot.java
Normal file
9
src/main/java/tech/nevets/vplus/items/PlatinumIngot.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package tech.nevets.vplus.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class PlatinumIngot extends Item {
|
||||
public PlatinumIngot(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package tech.nevets.vplus.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class PlatinumNugget extends Item {
|
||||
public PlatinumNugget(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
}
|
||||
9
src/main/java/tech/nevets/vplus/items/Ruby.java
Normal file
9
src/main/java/tech/nevets/vplus/items/Ruby.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package tech.nevets.vplus.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class Ruby extends Item {
|
||||
public Ruby(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
}
|
||||
31
src/main/java/tech/nevets/vplus/items/VPItemGroups.java
Normal file
31
src/main/java/tech/nevets/vplus/items/VPItemGroups.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package tech.nevets.vplus.items;
|
||||
|
||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class VPItemGroups {
|
||||
//Creative Tab
|
||||
public static final ItemGroup ALL = FabricItemGroupBuilder.build(
|
||||
new Identifier("vplus", "all"),
|
||||
() -> new ItemStack((Items.GRASS_BLOCK)));
|
||||
//Combat Tab
|
||||
public static final ItemGroup COMBAT = FabricItemGroupBuilder.build(
|
||||
new Identifier("vplus", "combat"),
|
||||
() -> new ItemStack((Items.DIAMOND_SWORD)));
|
||||
//Tools Tab
|
||||
public static final ItemGroup TOOLS = FabricItemGroupBuilder.create(
|
||||
new Identifier("vplus", "tools"))
|
||||
.icon(() -> new ItemStack(Items.DIAMOND_PICKAXE))
|
||||
/*.appendItems(stacks -> {
|
||||
stacks.add(new ItemStack(Main.RUBY));
|
||||
stacks.add(new ItemStack(Items.EMERALD_BLOCK));
|
||||
})*/
|
||||
.build();
|
||||
//Food Tab
|
||||
public static final ItemGroup FOOD = FabricItemGroupBuilder.build(
|
||||
new Identifier("vplus", "food"),
|
||||
() -> new ItemStack((Items.ENCHANTED_GOLDEN_APPLE)));
|
||||
}
|
||||
23
src/main/java/tech/nevets/vplus/items/VPItems.java
Normal file
23
src/main/java/tech/nevets/vplus/items/VPItems.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package tech.nevets.vplus.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class VPItems {
|
||||
|
||||
public static final Item PLATINUMINGOT = new PlatinumIngot(new Item.Settings().group(VPItemGroups.ALL));
|
||||
public static final Item PLATINUMNUGGET = new PlatinumNugget(new Item.Settings().group(VPItemGroups.ALL));
|
||||
public static final Item RUBY = new Ruby(new Item.Settings().group(VPItemGroups.ALL));
|
||||
|
||||
public static void vpItems() {
|
||||
initializeValuables();
|
||||
}
|
||||
|
||||
public static void initializeValuables() {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_ingot"), PLATINUMINGOT);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_nugget"), PLATINUMNUGGET);
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby"), RUBY);
|
||||
}
|
||||
|
||||
}
|
||||
10
src/main/java/tech/nevets/vplus/misc/VPFuels.java
Normal file
10
src/main/java/tech/nevets/vplus/misc/VPFuels.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package tech.nevets.vplus.misc;
|
||||
|
||||
import net.fabricmc.fabric.api.registry.FuelRegistry;
|
||||
import tech.nevets.vplus.blocks.SaturatedLavaSpongeBlock;
|
||||
|
||||
public class VPFuels {
|
||||
public static void vpFuels() {
|
||||
FuelRegistry.INSTANCE.add(new SaturatedLavaSpongeBlock(), 20000);
|
||||
}
|
||||
}
|
||||
37
src/main/java/tech/nevets/vplus/misc/VPOreGen.java
Normal file
37
src/main/java/tech/nevets/vplus/misc/VPOreGen.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package tech.nevets.vplus.misc;
|
||||
|
||||
import net.minecraft.world.gen.decorator.Decorator;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||
import tech.nevets.vplus.blocks.VPBlocks;
|
||||
|
||||
public class VPOreGen {
|
||||
|
||||
/*
|
||||
private static ConfiguredFeature<?, ?> ORE_PLATINUM_OVERWORLD = Feature.ORE
|
||||
.configure(new OreFeatureConfig(
|
||||
OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
|
||||
VPBlocks.PLATINUMORE.getDefaultState(),
|
||||
3)) // vein size
|
||||
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(
|
||||
0, // bottom offset
|
||||
0, // min y level
|
||||
15))) // max y level
|
||||
.spreadHorizontally()
|
||||
.repeat(2); // number of veins per chunk
|
||||
|
||||
private static ConfiguredFeature<?, ?> ORE_RUBY_OVERWORLD = Feature.ORE
|
||||
.configure(new OreFeatureConfig(
|
||||
OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
|
||||
VPBlocks.RUBYORE.getDefaultState(),
|
||||
1)) // vein size
|
||||
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(
|
||||
0, // bottom offset
|
||||
0, // min y level
|
||||
256))) // max y level
|
||||
.spreadHorizontally()
|
||||
.repeat(8); // number of veins per chunk
|
||||
*/
|
||||
|
||||
}
|
||||
25
src/main/java/tech/nevets/vplus/misc/VPZoom.java
Normal file
25
src/main/java/tech/nevets/vplus/misc/VPZoom.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package tech.nevets.vplus.misc;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class VPZoom {
|
||||
|
||||
public static Boolean currentlyZoomed;
|
||||
public static KeyBinding keyBinding;
|
||||
public static Boolean originalSmoothCameraEnabled;
|
||||
public static final MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public static void vpZoom() {
|
||||
keyBinding = new KeyBinding("key.vplus.zoom", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_C, "category.vplus.zoom");
|
||||
currentlyZoomed = false;
|
||||
originalSmoothCameraEnabled = false;
|
||||
KeyBindingHelper.registerKeyBinding(keyBinding);
|
||||
}
|
||||
}
|
||||
2
src/main/java/tech/nevets/vplus/mixin/ZoomMixin.java
Normal file
2
src/main/java/tech/nevets/vplus/mixin/ZoomMixin.java
Normal file
@@ -0,0 +1,2 @@
|
||||
package tech.nevets.vplus.mixin;public class ZoomMixin {
|
||||
}
|
||||
11
src/main/java/tech/nevets/vplus/tools/AxeBase.java
Normal file
11
src/main/java/tech/nevets/vplus/tools/AxeBase.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package tech.nevets.vplus.tools;
|
||||
|
||||
import net.minecraft.item.AxeItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class AxeBase extends AxeItem {
|
||||
public AxeBase(ToolMaterial toolMaterial_1) {
|
||||
super(toolMaterial_1, 5, -3.0f, new Settings().group(VPItemGroups.TOOLS));
|
||||
}
|
||||
}
|
||||
11
src/main/java/tech/nevets/vplus/tools/HoeBase.java
Normal file
11
src/main/java/tech/nevets/vplus/tools/HoeBase.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package tech.nevets.vplus.tools;
|
||||
|
||||
import net.minecraft.item.HoeItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class HoeBase extends HoeItem {
|
||||
public HoeBase(ToolMaterial toolMaterial_1) {
|
||||
super(toolMaterial_1, -3, 0f, new Settings().group(VPItemGroups.TOOLS));
|
||||
}
|
||||
}
|
||||
11
src/main/java/tech/nevets/vplus/tools/PickaxeBase.java
Normal file
11
src/main/java/tech/nevets/vplus/tools/PickaxeBase.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package tech.nevets.vplus.tools;
|
||||
|
||||
import net.minecraft.item.PickaxeItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class PickaxeBase extends PickaxeItem {
|
||||
public PickaxeBase(ToolMaterial toolMaterial_1) {
|
||||
super(toolMaterial_1, 1, -2.8f, new Settings().group(VPItemGroups.TOOLS));
|
||||
}
|
||||
}
|
||||
11
src/main/java/tech/nevets/vplus/tools/ShovelBase.java
Normal file
11
src/main/java/tech/nevets/vplus/tools/ShovelBase.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package tech.nevets.vplus.tools;
|
||||
|
||||
import net.minecraft.item.ShovelItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class ShovelBase extends ShovelItem {
|
||||
public ShovelBase(ToolMaterial toolMaterial_1) {
|
||||
super(toolMaterial_1, 1, -3f, new Settings().group(VPItemGroups.TOOLS));
|
||||
}
|
||||
}
|
||||
11
src/main/java/tech/nevets/vplus/tools/SwordBase.java
Normal file
11
src/main/java/tech/nevets/vplus/tools/SwordBase.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package tech.nevets.vplus.tools;
|
||||
|
||||
import net.minecraft.item.SwordItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
public class SwordBase extends SwordItem {
|
||||
public SwordBase(ToolMaterial toolMaterial_1) {
|
||||
super(toolMaterial_1, 2, -2.4f, new Settings().group(VPItemGroups.COMBAT));
|
||||
}
|
||||
}
|
||||
60
src/main/java/tech/nevets/vplus/tools/ToolMaterials.java
Normal file
60
src/main/java/tech/nevets/vplus/tools/ToolMaterials.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package tech.nevets.vplus.tools;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.util.Lazy;
|
||||
import tech.nevets.vplus.items.VPItems;
|
||||
|
||||
public enum ToolMaterials implements ToolMaterial {
|
||||
EMERALD(3, 750, 7.0F, 4.0F, 30, () -> {
|
||||
return Ingredient.ofItems(new ItemConvertible[]{Items.EMERALD});
|
||||
}),
|
||||
PLATINUM(4, 3000, 10.0F, 6.0F, 40, () -> {
|
||||
return Ingredient.ofItems(new ItemConvertible[]{VPItems.PLATINUMINGOT});
|
||||
}),
|
||||
RUBY(4, 5000, 12.0F, 10.0F, 100, () -> {
|
||||
return Ingredient.ofItems(new ItemConvertible[]{VPItems.RUBY});
|
||||
});
|
||||
|
||||
private final int miningLevel;
|
||||
private final int itemDurability;
|
||||
private final float miningSpeed;
|
||||
private final float attackDamage;
|
||||
private final int enchantability;
|
||||
private final Lazy<Ingredient> repairIngredient;
|
||||
private ToolMaterials(int miningLevel, int itemDurability, float miningSpeed, float attackDamage, int enchantability, Supplier<Ingredient> repairIngredient) {
|
||||
this.miningLevel = miningLevel;
|
||||
this.itemDurability = itemDurability;
|
||||
this.miningSpeed = miningSpeed;
|
||||
this.attackDamage = attackDamage;
|
||||
this.enchantability = enchantability;
|
||||
this.repairIngredient = new Lazy(repairIngredient);
|
||||
}
|
||||
|
||||
public int getDurability() {
|
||||
return this.itemDurability;
|
||||
}
|
||||
|
||||
public float getMiningSpeedMultiplier() {
|
||||
return this.miningSpeed;
|
||||
}
|
||||
|
||||
public float getAttackDamage() {
|
||||
return this.attackDamage;
|
||||
}
|
||||
|
||||
public int getMiningLevel() {
|
||||
return this.miningLevel;
|
||||
}
|
||||
|
||||
public int getEnchantability() {
|
||||
return this.enchantability;
|
||||
}
|
||||
|
||||
public Ingredient getRepairIngredient() {
|
||||
return (Ingredient)this.repairIngredient.get();
|
||||
}
|
||||
}
|
||||
45
src/main/java/tech/nevets/vplus/tools/VPTools.java
Normal file
45
src/main/java/tech/nevets/vplus/tools/VPTools.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package tech.nevets.vplus.tools;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class VPTools {
|
||||
|
||||
public static void vpTools() {
|
||||
initializeAxes();
|
||||
initializeHoes();
|
||||
initializePickaxes();
|
||||
initializeShovels();
|
||||
initializeSwords();
|
||||
}
|
||||
|
||||
public static void initializeAxes() {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "emerald_axe"), new AxeBase(ToolMaterials.EMERALD));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_axe"), new AxeBase(ToolMaterials.PLATINUM));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby_axe"), new AxeBase(ToolMaterials.RUBY));
|
||||
}
|
||||
|
||||
public static void initializeHoes() {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "emerald_hoe"), new HoeBase(ToolMaterials.EMERALD));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_hoe"), new HoeBase(ToolMaterials.PLATINUM));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby_hoe"), new HoeBase(ToolMaterials.RUBY));
|
||||
}
|
||||
|
||||
public static void initializePickaxes() {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "emerald_pickaxe"), new PickaxeBase(ToolMaterials.EMERALD));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_pickaxe"), new PickaxeBase(ToolMaterials.PLATINUM));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby_pickaxe"), new PickaxeBase(ToolMaterials.RUBY));
|
||||
}
|
||||
|
||||
public static void initializeShovels() {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "emerald_shovel"), new ShovelBase(ToolMaterials.EMERALD));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_shovel"), new ShovelBase(ToolMaterials.PLATINUM));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby_shovel"), new ShovelBase(ToolMaterials.RUBY));
|
||||
}
|
||||
|
||||
public static void initializeSwords() {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "emerald_sword"), new SwordBase(ToolMaterials.EMERALD));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "platinum_sword"), new SwordBase(ToolMaterials.PLATINUM));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", "ruby_sword"), new SwordBase(ToolMaterials.RUBY));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user