merge conflict 2

This commit is contained in:
2022-08-03 09:33:14 -04:00
parent 09c81a117a
commit a0d866d838
284 changed files with 292 additions and 360 deletions

View File

@@ -0,0 +1,75 @@
package tech.nevets.vplus.blocks;
import com.google.common.collect.Lists;
import net.minecraft.block.*;
import net.minecraft.fluid.FluidState;
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(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(1.5F, 1.5F));
}
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 sourceBlock, BlockPos sourcePos, boolean notify) {
this.update(world, pos);
super.neighborUpdate(state, world, pos, sourceBlock, sourcePos, notify);
}
protected void update(World world, BlockPos pos) {
if (this.absorbLava(world, pos)) {
world.setBlockState(pos, VPBlocks.SATURATED_LAVA_SPONGE_BLOCK.getDefaultState(), 2);
world.syncWorldEvent(2001, pos, Block.getRawIdFromState(Blocks.WATER.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 = queue.poll();
BlockPos blockPos = pair.getLeft();
int j = pair.getRight();
Direction[] directions = Direction.values();
for (Direction direction : directions) {
BlockPos blockPos2 = blockPos.offset(direction);
BlockState blockState = world.getBlockState(blockPos2);
FluidState fluidState = world.getFluidState(blockPos2);
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;
}
}

View File

@@ -0,0 +1,58 @@
package tech.nevets.vplus.blocks;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;
public class SaturatedLavaSpongeBlock extends Block {
public SaturatedLavaSpongeBlock() {
super(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(1.5F, 1.5F));
}
@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 = pos.getX();
double e = pos.getY();
double f = 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);
}
}
}
}

View File

@@ -33,8 +33,8 @@ public class VPBlocks {
SAPPHIRE_BLOCK = register("sapphire_block", new Block(AbstractBlock.Settings.of(Material.METAL).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.BLOCKS).getBlock();
RUBY_BLOCK = register("ruby_block", new Block(AbstractBlock.Settings.of(Material.METAL).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.BLOCKS).getBlock();
JADE_BLOCK = register("jade_block", new Block(AbstractBlock.Settings.of(Material.METAL).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.BLOCKS).getBlock();
LAVA_SPONGE_BLOCK = register("lava_sponge_block", new Block(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(1.5F, 1.5F)), VPItemGroups.BLOCKS).getBlock();
SATURATED_LAVA_SPONGE_BLOCK = register("saturated_lava_sponge_block", new Block(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(1.5F, 1.5F)), VPItemGroups.BLOCKS, new Item.Settings().recipeRemainder(Item.fromBlock(LAVA_SPONGE_BLOCK))).getBlock();
LAVA_SPONGE_BLOCK = register("lava_sponge", new LavaSpongeBlock(), VPItemGroups.BLOCKS).getBlock();
SATURATED_LAVA_SPONGE_BLOCK = register("saturated_lava_sponge", new SaturatedLavaSpongeBlock(), VPItemGroups.BLOCKS, new Item.Settings().recipeRemainder(Item.fromBlock(LAVA_SPONGE_BLOCK))).getBlock();
///////////////////\\\\ITERATOR////\\\\\\\\\\\\\\\\\\\

View File

@@ -10,19 +10,19 @@ import net.minecraft.sound.SoundEvents;
public enum VPMaterials implements ToolMaterial, ArmorMaterial {
COPPER(20, Ingredient.ofItems(Items.COPPER_INGOT), "copper", 13, new int[]{2, 4, 5, 2}, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F, 0.0F, 2, 200, 5.0F, 3.0F),
EMERALD(30, Ingredient.ofItems(Items.EMERALD), "emerald", 30, new int[]{2, 6, 8, 2}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.5F, 0.0F, 3, 750, 7.0F, 4.0F),
SAPPHIRE(50, Ingredient.ofItems(VPItems.SAPPHIRE), "sapphire", 40, new int[]{6, 8, 10, 6}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, 0.1F, 4, 3000, 8.0F, 6.0F),
RUBY(50, Ingredient.ofItems(VPItems.RUBY), "ruby", 40, new int[]{10, 15, 20, 10}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, .01F, 4, 3000, 8.0F, 6.0F),
JADE(50, Ingredient.ofItems(VPItems.JADE), "jade", 40, new int[]{10, 15, 20, 10}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, 0.1F, 4, 3000, 8.0F, 6.0F);
COPPER("copper", 20, Ingredient.ofItems(Items.COPPER_INGOT), 13, new int[]{2, 4, 5, 2}, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F, 0.0F, 2, 200, 5.0F, 3.0F),
EMERALD("emerald", 30, Ingredient.ofItems(Items.EMERALD), 30, new int[]{2, 6, 8, 2}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.5F, 0.0F, 3, 750, 7.0F, 4.0F),
SAPPHIRE("sapphire", 50, Ingredient.ofItems(VPItems.SAPPHIRE), 40, new int[]{6, 8, 10, 6}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, 0.1F, 4, 3000, 8.0F, 6.0F),
RUBY("ruby", 50, Ingredient.ofItems(VPItems.RUBY), 40, new int[]{10, 15, 20, 10}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, .01F, 4, 3000, 8.0F, 6.0F),
JADE("jade", 50, Ingredient.ofItems(VPItems.JADE), 40, new int[]{10, 15, 20, 10}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, 0.1F, 4, 3000, 8.0F, 6.0F);
private static final int[] BASE_ARMOR_DURABILITY = new int[]{13, 15, 16, 11};
// Used by both
private String name;
private int enchantability;
private Ingredient repairIngredient;
// Used by armor
private String name;
private int armorDurability;
private int[] protectionAmounts;
private SoundEvent equipSound;
@@ -49,7 +49,8 @@ public enum VPMaterials implements ToolMaterial, ArmorMaterial {
}
// Used for tool materials
VPMaterials(int miningLevel, int toolDurability, float miningSpeed, float attackDamage, int enchantability, Ingredient repairIngredient) {
VPMaterials(String name, int miningLevel, int toolDurability, float miningSpeed, float attackDamage, int enchantability, Ingredient repairIngredient) {
this.name = name;
this.miningLevel = miningLevel;
this.toolDurability = toolDurability;
this.miningSpeed = miningSpeed;
@@ -59,10 +60,10 @@ public enum VPMaterials implements ToolMaterial, ArmorMaterial {
}
//Used for both
VPMaterials(int enchantability, Ingredient repairIngredient, String name, int armorDurability, int[] protectionAmounts, SoundEvent equipSound, float toughness, float knockbackResistance, int miningLevel, int toolDurability, float miningSpeed, float attackDamage) {
VPMaterials(String name, int enchantability, Ingredient repairIngredient, int armorDurability, int[] protectionAmounts, SoundEvent equipSound, float toughness, float knockbackResistance, int miningLevel, int toolDurability, float miningSpeed, float attackDamage) {
this.name = name;
this.enchantability = enchantability;
this.repairIngredient = repairIngredient;
this.name = name;
this.armorDurability = armorDurability;
this.protectionAmounts = protectionAmounts;
this.equipSound = equipSound;

View File

@@ -0,0 +1,10 @@
package tech.nevets.vplus.items.tools;
import net.minecraft.item.SwordItem;
import net.minecraft.item.ToolMaterial;
public class LongSwordBase extends SwordItem {
public LongSwordBase(ToolMaterial toolMaterial, Settings settings) {
super(toolMaterial, 2, -3.F, settings);
}
}