diff --git a/build.gradle b/build.gradle index a6c47e1..321ed74 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -version = '1.4.2-1.16.x' +version = '1.5.0-1.16.x' group = 'com.northwestwind.moreboots' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'moreboots' diff --git a/src/main/java/com/northwestwind/moreboots/handler/MoreBootsHandler.java b/src/main/java/com/northwestwind/moreboots/handler/MoreBootsHandler.java index 20d7192..35e58b5 100644 --- a/src/main/java/com/northwestwind/moreboots/handler/MoreBootsHandler.java +++ b/src/main/java/com/northwestwind/moreboots/handler/MoreBootsHandler.java @@ -6,6 +6,7 @@ import com.northwestwind.moreboots.init.EffectInit; import com.northwestwind.moreboots.init.ItemInit; import com.northwestwind.moreboots.init.block.GlowstoneDustBlock; +import com.northwestwind.moreboots.init.block.InvisibleBlock; import com.northwestwind.moreboots.init.block.KeybindInit; import net.minecraft.block.*; import net.minecraft.block.material.Material; @@ -25,6 +26,7 @@ import net.minecraft.potion.*; import net.minecraft.server.MinecraftServer; import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.tags.FluidTags; import net.minecraft.util.*; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -32,7 +34,6 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.Explosion; -import net.minecraft.world.biome.Biome; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -41,7 +42,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerXpEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import org.apache.logging.log4j.LogManager; import org.lwjgl.glfw.GLFW; import java.util.*; @@ -118,7 +118,7 @@ public void onLivingDamage(final LivingDamageEvent event) { if (entity.world.isRemote) return; event.setCanceled(true); boots.damageItem(1, entity, entity1 -> entity1.playSound(SoundEvents.BLOCK_GLASS_BREAK, 1.0f, 1.0f)); - } else if (boots.getItem().equals(ItemInit.BLAZE_BOOTS)) { + } else if (boots.getItem().equals(ItemInit.BLAZE_BOOTS) || boots.getItem().equals(ItemInit.STRIDER_BOOTS)) { DamageSource source = event.getSource(); if (source.equals(DamageSource.IN_FIRE) || source.equals(DamageSource.LAVA) || source.equals(DamageSource.ON_FIRE)) event.setCanceled(true); @@ -376,16 +376,31 @@ public void onLivingUpdate(final LivingEvent.LivingUpdateEvent event) { newBoots.setDamage(boots.getDamage()); entity.setItemStackToSlot(EquipmentSlotType.FEET, newBoots); } - } else if (boots.getItem().equals(ItemInit.JESUS_BOOTS)) { + } else if (boots.getItem().equals(ItemInit.FLOATIE_BOOTS)) { BlockPos pos = new BlockPos(entity.getPositionVec()); - FluidState under = entity.world.getFluidState(pos.down()); if (entity.isInWater()) { entity.setMotion(entity.getMotion().add(0, 0.1, 0)); entity.velocityChanged = true; - } else if (!entity.world.isRemote && entity.world.isAirBlock(pos.down())) { - if (!(under.getFluid().equals(Fluids.WATER) || under.getFluid().equals(Fluids.FLOWING_WATER))) return; - entity.world.setBlockState(pos.down(), BlockInit.INVISIBLE.getDefaultState()); - } + } else if (!entity.world.isRemote) + for (BlockPos blockpos : BlockPos.getAllInBoxMutable(pos.add(-1, -1.0D, -1), pos.add(1, -1.0D, 1))) { + FluidState under = entity.world.getFluidState(blockpos); + if (!entity.world.getBlockState(blockpos).getCollisionShape(entity.world, blockpos).equals(VoxelShapes.empty()) || !under.isTagged(FluidTags.WATER)) + continue; + entity.world.setBlockState(blockpos, BlockInit.INVISIBLE.getDefaultState().with(BlockStateProperties.WATERLOGGED, true).with(InvisibleBlock.FLOWINGLOGGED, !under.isSource())); + } + } else if (boots.getItem().equals(ItemInit.STRIDER_BOOTS)) { + entity.extinguish(); + BlockPos pos = new BlockPos(entity.getPositionVec()); + if (entity.isInLava()) { + entity.setMotion(entity.getMotion().add(0, 0.1, 0)); + entity.velocityChanged = true; + } else if (!entity.world.isRemote) + for (BlockPos blockpos : BlockPos.getAllInBoxMutable(pos.add(-1, -1.0D, -1), pos.add(1, -1.0D, 1))) { + FluidState under = entity.world.getFluidState(blockpos); + if (!entity.world.getBlockState(blockpos).getCollisionShape(entity.world, blockpos).equals(VoxelShapes.empty()) || !under.isTagged(FluidTags.LAVA)) + continue; + entity.world.setBlockState(blockpos, BlockInit.INVISIBLE.getDefaultState().with(InvisibleBlock.LAVALOGGED, true).with(InvisibleBlock.FLOWINGLOGGED, !under.isSource())); + } } } @@ -423,10 +438,15 @@ public void onLivingDrop(final LivingDropsEvent event) { int shouldDrop = rng.nextInt((1 + looting) * 2) + looting; if (shouldDrop < 1) return; LivingEntity entity = event.getEntityLiving(); - if (!entity.getType().equals(EntityType.BAT)) return; - ItemStack stack = new ItemStack(ItemInit.BAT_HIDE, shouldDrop); - ItemEntity item = new ItemEntity(entity.world, entity.getPosX(), entity.getPosY(), entity.getPosZ(), stack); - event.getDrops().add(item); + if (entity.getType().equals(EntityType.BAT)) { + ItemStack stack = new ItemStack(ItemInit.BAT_HIDE, shouldDrop); + ItemEntity item = new ItemEntity(entity.world, entity.getPosX(), entity.getPosY(), entity.getPosZ(), stack); + event.getDrops().add(item); + } else if (entity.getType().equals(EntityType.field_233589_aE_)) { + ItemStack stack = new ItemStack(ItemInit.STRIDER_FOOT, shouldDrop); + ItemEntity item = new ItemEntity(entity.world, entity.getPosX(), entity.getPosY(), entity.getPosZ(), stack); + event.getDrops().add(item); + } } private void breakGlassBoots(ItemStack stack, Potion potion, LivingEntity entity) { @@ -437,10 +457,10 @@ private void breakGlassBoots(ItemStack stack, Potion potion, LivingEntity entity areaeffectcloudentity.setRadius(3.0F); areaeffectcloudentity.setRadiusOnUse(-0.5F); areaeffectcloudentity.setWaitTime(10); - areaeffectcloudentity.setRadiusPerTick(-areaeffectcloudentity.getRadius() / (float)areaeffectcloudentity.getDuration()); + areaeffectcloudentity.setRadiusPerTick(-areaeffectcloudentity.getRadius() / (float) areaeffectcloudentity.getDuration()); areaeffectcloudentity.setPotion(potion); - for(EffectInstance effectinstance : PotionUtils.getFullEffectsFromItem(stack)) { + for (EffectInstance effectinstance : PotionUtils.getFullEffectsFromItem(stack)) { areaeffectcloudentity.addEffect(new EffectInstance(effectinstance)); } diff --git a/src/main/java/com/northwestwind/moreboots/handler/Utils.java b/src/main/java/com/northwestwind/moreboots/handler/Utils.java index b01c8fe..4e788d1 100644 --- a/src/main/java/com/northwestwind/moreboots/handler/Utils.java +++ b/src/main/java/com/northwestwind/moreboots/handler/Utils.java @@ -1,5 +1,8 @@ package com.northwestwind.moreboots.handler; +import com.northwestwind.moreboots.init.BlockInit; +import com.northwestwind.moreboots.init.block.InvisibleBlock; +import it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -9,10 +12,16 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.fluid.FlowingFluid; import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.FluidState; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.tags.FluidTags; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; @@ -64,19 +73,18 @@ public static void changeGroundBlocks(LivingEntity living, World worldIn, BlockP if (blockstate1.isAir(worldIn, blockpos$mutable)) { BlockState blockstate2 = worldIn.getBlockState(blockpos); boolean shouldChange = target.contains(blockstate2.getBlock()); - if (shouldChange) worldIn.setBlockState(blockpos, to.get(new Random().nextInt(to.size())).getDefaultState()); + if (shouldChange) + worldIn.setBlockState(blockpos, to.get(new Random().nextInt(to.size())).getDefaultState()); } } } } - public static byte[] objToBytes(Object obj) - { + public static byte[] objToBytes(Object obj) { byte[] bytes = null; ByteArrayOutputStream bos = null; ObjectOutputStream oos = null; - try - { + try { bos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(bos); oos.writeObject(obj); @@ -84,51 +92,35 @@ public static byte[] objToBytes(Object obj) bytes = bos.toByteArray(); } catch (IOException e) { e.printStackTrace(); - } finally - { + } finally { try { - if(oos != null)oos.close(); - if(bos != null)bos.close(); - } catch(IOException ex) { + if (oos != null) oos.close(); + if (bos != null) bos.close(); + } catch (IOException ex) { ex.printStackTrace(); } } return bytes; } - public static Object bytesToObj(byte[] bytes) - { + public static Object bytesToObj(byte[] bytes) { Object obj = null; ByteArrayInputStream bis = null; ObjectInputStream ois = null; - try - { + try { bis = new ByteArrayInputStream(bytes); ois = new ObjectInputStream(bis); obj = ois.readObject(); } catch (IOException | ClassNotFoundException e) { e.printStackTrace(); - } finally - { + } finally { try { if (ois != null) ois.close(); if (bis != null) bis.close(); - } catch(IOException ex) { + } catch (IOException ex) { ex.printStackTrace(); } } return obj; } - - @Nullable - public static Entity findEntityByUUID(UUID uuid, ServerWorld world) { - Stream entities = world.getEntities(); - LivingEntity entity = null; - for(Entity ent : entities.toArray(Entity[]::new)) { - if(ent.getUniqueID().equals(uuid)) { - entity = (LivingEntity) ent; - } - } - return entity; - } } diff --git a/src/main/java/com/northwestwind/moreboots/init/ItemInit.java b/src/main/java/com/northwestwind/moreboots/init/ItemInit.java index d91b826..2bd6ee4 100644 --- a/src/main/java/com/northwestwind/moreboots/init/ItemInit.java +++ b/src/main/java/com/northwestwind/moreboots/init/ItemInit.java @@ -4,7 +4,6 @@ import com.northwestwind.moreboots.Reference; import com.northwestwind.moreboots.init.item.ArmorItemBase; import com.northwestwind.moreboots.init.item.ItemBase; -import com.northwestwind.moreboots.init.item.SniperCrossbowItem; import net.minecraft.block.Blocks; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.*; @@ -59,12 +58,14 @@ public class ItemInit { public static final Item KA_BOOTS = registerBoots(ModArmorMaterial.KA, "ka_boots"); public static final Item GLASS_BOOTS = registerBoots(ModArmorMaterial.GLASS, "glass_boots"); public static final Item GLASS_BOOTS_EMPTY = registerBoots(ModArmorMaterial.GLASS_EMPTY, "glass_boots_empty"); - public static final Item JESUS_BOOTS = registerBoots(ModArmorMaterial.JESUS, "jesus_boots"); + public static final Item FLOATIE_BOOTS = registerBoots(ModArmorMaterial.FLOATIE, "floatie_boots", true); + public static final Item STRIDER_BOOTS = registerBoots(ModArmorMaterial.STRIDER, "strider_boots", true); //public static final Item SNIPER_BOOTS = registerBoots(ModArmorMaterial.SNIPER, "sniper_boots"); public static final Item QUARTZ_INGOT = new ItemBase(new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE), "quartz_ingot").setRegistryName("quartz_ingot"); public static final Item METAL_MIX = new ItemBase(new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE), "metal_mix").setRegistryName("metal_mix"); public static final Item BAT_HIDE = new ItemBase(new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE), "bat_hide").setRegistryName("bat_hide"); + public static final Item STRIDER_FOOT = new ItemBase(new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE), "strider_foot").setRegistryName("strider_foot"); //public static final Item CROSSBOW = new SniperCrossbowItem().setRegistryName("minecraft", "crossbow"); @@ -102,18 +103,24 @@ public static void registerItems(final RegistryEvent.Register event) { event.getRegistry().register(KA_BOOTS); event.getRegistry().register(GLASS_BOOTS); event.getRegistry().register(GLASS_BOOTS_EMPTY); - event.getRegistry().register(JESUS_BOOTS); + event.getRegistry().register(FLOATIE_BOOTS); + event.getRegistry().register(STRIDER_BOOTS); //event.getRegistry().register(SNIPER_BOOTS); event.getRegistry().register(QUARTZ_INGOT); event.getRegistry().register(METAL_MIX); event.getRegistry().register(BAT_HIDE); + event.getRegistry().register(STRIDER_FOOT); //event.getRegistry().register(CROSSBOW); } public static Item registerBoots(IArmorMaterial material, String registryName) { - return new ArmorItemBase(material, registryName).setRegistryName(registryName); + return registerBoots(material, registryName, false); + } + + public static Item registerBoots(IArmorMaterial material, String registryName, boolean isNetherite) { + return new ArmorItemBase(material, registryName, isNetherite).setRegistryName(registryName); } public enum ModArmorMaterial implements IArmorMaterial { @@ -180,7 +187,8 @@ public enum ModArmorMaterial implements IArmorMaterial { GLASS_EMPTY(Reference.MODID + ":glass", 10, new int[] { 4, 1, 1, 1 }, 20, SoundEvents.ITEM_BOTTLE_FILL, 0.0f, 0.0f, () -> Ingredient.fromItems(Items.GLASS)), GLASS(Reference.MODID + ":glass", 10, new int[] { 4, 1, 1, 1 }, 20, SoundEvents.BLOCK_GLASS_BREAK, 0.0f, 0.0f, () -> Ingredient.fromItems(Items.GLASS)), SNIPER(Reference.MODID + ":sniper", 8, new int[] { 2, 1, 1, 1 }, 12, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0f, 0.0f, 90000, () -> Ingredient.fromItems(Items.TIPPED_ARROW)), - JESUS(Reference.MODID + ":jesus", 40, new int[] { 4, 1, 1, 1 }, 15, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0f, 0.0f, 160000, () -> Ingredient.fromItems(Items.field_234759_km_)); + FLOATIE(Reference.MODID + ":floatie", 40, new int[] { 4, 1, 1, 1 }, 15, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0f, 0.0f, 160000, () -> Ingredient.fromItems(Items.field_234759_km_)), + STRIDER(Reference.MODID + ":strider", 40, new int[] { 4, 1, 1, 1 }, 15, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0f, 0.0f, 160000, () -> Ingredient.fromItems(ItemInit.STRIDER_FOOT)); private static final int[] MAX_DAMAGE_ARRAY = new int[] { 16, 16, 16, 16 }; private final String name; private final float maxDamageFactor; diff --git a/src/main/java/com/northwestwind/moreboots/init/block/InvisibleBlock.java b/src/main/java/com/northwestwind/moreboots/init/block/InvisibleBlock.java index 2cc263b..1409a8e 100644 --- a/src/main/java/com/northwestwind/moreboots/init/block/InvisibleBlock.java +++ b/src/main/java/com/northwestwind/moreboots/init/block/InvisibleBlock.java @@ -1,29 +1,32 @@ package com.northwestwind.moreboots.init.block; -import com.northwestwind.moreboots.Reference; import com.northwestwind.moreboots.init.ItemInit; import com.northwestwind.moreboots.init.tileentity.InvisibleTileEntity; import com.northwestwind.moreboots.interfaces.IVanillaLoggable; import net.minecraft.block.Block; -import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; -import net.minecraft.block.IWaterLoggable; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; +import net.minecraft.fluid.*; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.BlockItemUseContext; +import net.minecraft.item.ItemStack; +import net.minecraft.pathfinding.PathType; import net.minecraft.state.BooleanProperty; -import net.minecraft.state.Property; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.state.properties.SlabType; +import net.minecraft.tags.FluidTags; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorld; + +import javax.annotation.Nullable; public class InvisibleBlock extends Block implements IVanillaLoggable { public static final BooleanProperty LAVALOGGED = BooleanProperty.create("lava_logged"); @@ -36,24 +39,26 @@ public InvisibleBlock() { this.setDefaultState(this.getDefaultState().with(LAVALOGGED, false).with(WATERLOGGED, false).with(FLOWINGLOGGED, false)); } + @Override + public boolean isTransparent(BlockState state) { + return true; + } + @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return TOP_SHAPE; + return VoxelShapes.empty(); } @Override public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { Entity entity = context.getEntity(); if (!(entity instanceof LivingEntity)) return VoxelShapes.empty(); - if (!((LivingEntity) entity).getItemStackFromSlot(EquipmentSlotType.FEET).getItem().equals(ItemInit.JESUS_BOOTS)) return VoxelShapes.empty(); + ItemStack boots = ((LivingEntity) entity).getItemStackFromSlot(EquipmentSlotType.FEET); + if (!boots.getItem().equals(ItemInit.STRIDER_BOOTS) && !boots.getItem().equals(ItemInit.FLOATIE_BOOTS)) return VoxelShapes.empty(); if (entity.getPosY() < pos.up().getY()) return VoxelShapes.empty(); return TOP_SHAPE; } - public BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.INVISIBLE; - } - @Override protected void fillStateContainer(StateContainer.Builder builder) { super.fillStateContainer(builder); @@ -69,4 +74,60 @@ public boolean hasTileEntity(BlockState state) { public TileEntity createTileEntity(BlockState state, IBlockReader world) { return new InvisibleTileEntity(); } + + @Override + public boolean isReplaceable(BlockState p_225541_1_, Fluid p_225541_2_) { + return true; + } + + @Override + public boolean isReplaceable(BlockState state, BlockItemUseContext useContext) { + return true; + } + + @Nullable + public BlockState getStateForPlacement(BlockItemUseContext context) { + FluidState fluidstate = context.getWorld().getFluidState(context.getPos()); + if (fluidstate.isTagged(FluidTags.WATER)) { + BlockState state = this.getDefaultState().with(WATERLOGGED, true); + if (!fluidstate.isSource()) state = state.with(FLOWINGLOGGED, true); + return state; + } else if (fluidstate.isTagged(FluidTags.LAVA)) { + BlockState state = this.getDefaultState().with(LAVALOGGED, true); + if (!fluidstate.isSource()) state = state.with(FLOWINGLOGGED, true); + return state; + } else return this.getDefaultState(); + } + + public FluidState getFluidState(BlockState state) { + FluidState fluidState = super.getFluidState(state); + if (state.get(WATERLOGGED)) { + if (state.get(FLOWINGLOGGED)) fluidState = Fluids.FLOWING_WATER.getFlowingFluidState(4, false); + else fluidState = Fluids.WATER.getStillFluidState(false); + } else if (state.get(LAVALOGGED)) { + if (state.get(FLOWINGLOGGED)) fluidState = Fluids.FLOWING_LAVA.getFlowingFluidState(4, false); + else fluidState = Fluids.LAVA.getStillFluidState(false); + } + return fluidState; + } + + public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { + if (stateIn.get(WATERLOGGED)) { + if (stateIn.get(FLOWINGLOGGED)) worldIn.getPendingFluidTicks().scheduleTick(currentPos, Fluids.FLOWING_WATER, Fluids.FLOWING_WATER.getTickRate(worldIn)); + else worldIn.getPendingFluidTicks().scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn)); + } else if (stateIn.get(LAVALOGGED)) { + if (stateIn.get(FLOWINGLOGGED)) worldIn.getPendingFluidTicks().scheduleTick(currentPos, Fluids.FLOWING_LAVA, Fluids.FLOWING_LAVA.getTickRate(worldIn)); + else worldIn.getPendingFluidTicks().scheduleTick(currentPos, Fluids.LAVA, Fluids.LAVA.getTickRate(worldIn)); + } + + return super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos); + } + + public boolean allowsMovement(BlockState state, IBlockReader worldIn, BlockPos pos, PathType type) { + if (type == PathType.WATER) { + return worldIn.getFluidState(pos).isTagged(FluidTags.WATER); + } else return worldIn.getFluidState(pos).isTagged(FluidTags.LAVA) || super.allowsMovement(state, worldIn, pos, type); + } + + } diff --git a/src/main/java/com/northwestwind/moreboots/init/item/ArmorItemBase.java b/src/main/java/com/northwestwind/moreboots/init/item/ArmorItemBase.java index b058a16..2aa69c3 100644 --- a/src/main/java/com/northwestwind/moreboots/init/item/ArmorItemBase.java +++ b/src/main/java/com/northwestwind/moreboots/init/item/ArmorItemBase.java @@ -36,11 +36,15 @@ public class ArmorItemBase extends ArmorItem { private String registryName; - public ArmorItemBase(IArmorMaterial material, String registryName) { - super(material, EquipmentSlotType.FEET, material.equals(ItemInit.ModArmorMaterial.REDSTONE) ? new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE).maxStackSize(64) : new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE)); + public ArmorItemBase(IArmorMaterial material, String registryName, boolean isNetherite) { + super(material, EquipmentSlotType.FEET, isNetherite ? new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE).func_234689_a_() : new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE)); this.registryName = registryName; } + public ArmorItemBase(IArmorMaterial material, String registryName) { + this(material, registryName, false); + } + @Override @OnlyIn(Dist.CLIENT) public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { diff --git a/src/main/java/com/northwestwind/moreboots/init/tileentity/InvisibleTileEntity.java b/src/main/java/com/northwestwind/moreboots/init/tileentity/InvisibleTileEntity.java index 5b6757a..4416794 100644 --- a/src/main/java/com/northwestwind/moreboots/init/tileentity/InvisibleTileEntity.java +++ b/src/main/java/com/northwestwind/moreboots/init/tileentity/InvisibleTileEntity.java @@ -2,10 +2,10 @@ import com.northwestwind.moreboots.init.ItemInit; import com.northwestwind.moreboots.init.TileEntityInit; -import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.inventory.EquipmentSlotType; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EntityPredicates; @@ -24,14 +24,14 @@ public void tick() { List entities = world.getEntitiesInAABBexcluding(null, new AxisAlignedBB(pos).grow(0, 1, 0), EntityPredicates.NOT_SPECTATING); if (shouldBeGone(entities)) { world.removeBlock(pos, false); - } } private boolean shouldBeGone(List entities) { for (Entity entity : entities) { if (!(entity instanceof LivingEntity)) continue; - if (((LivingEntity) entity).getItemStackFromSlot(EquipmentSlotType.FEET).getItem().equals(ItemInit.JESUS_BOOTS)) return false; + ItemStack boots = ((LivingEntity) entity).getItemStackFromSlot(EquipmentSlotType.FEET); + if (boots.getItem().equals(ItemInit.FLOATIE_BOOTS) || boots.getItem().equals(ItemInit.STRIDER_BOOTS)) return false; } return true; } diff --git a/src/main/java/com/northwestwind/moreboots/interfaces/IVanillaLoggable.java b/src/main/java/com/northwestwind/moreboots/interfaces/IVanillaLoggable.java index 4a21068..36cca05 100644 --- a/src/main/java/com/northwestwind/moreboots/interfaces/IVanillaLoggable.java +++ b/src/main/java/com/northwestwind/moreboots/interfaces/IVanillaLoggable.java @@ -9,32 +9,29 @@ import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.tags.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; +import net.minecraftforge.common.util.Constants; +import org.apache.logging.log4j.LogManager; public interface IVanillaLoggable extends IBucketPickupHandler, ILiquidContainer { default boolean canContainFluid(IBlockReader worldIn, BlockPos pos, BlockState state, Fluid fluidIn) { - return (!state.get(BlockStateProperties.WATERLOGGED) && (fluidIn == Fluids.WATER || fluidIn == Fluids.FLOWING_WATER)) || (!state.get(InvisibleBlock.LAVALOGGED) && (fluidIn == Fluids.LAVA || fluidIn == Fluids.FLOWING_LAVA)); + return (!state.get(BlockStateProperties.WATERLOGGED) && fluidIn.isIn(FluidTags.WATER)) || (!state.get(InvisibleBlock.LAVALOGGED) && fluidIn.isIn(FluidTags.LAVA)); } default boolean receiveFluid(IWorld worldIn, BlockPos pos, BlockState state, FluidState fluidStateIn) { Fluid fluid = fluidStateIn.getFluid(); - if (!state.get(BlockStateProperties.WATERLOGGED) && (fluid == Fluids.WATER || fluid == Fluids.FLOWING_WATER)) { + if (canContainFluid(worldIn, pos, state, fluid)) { if (!worldIn.isRemote()) { - worldIn.setBlockState(pos, state.with(BlockStateProperties.WATERLOGGED, true), 3); - if (fluid == Fluids.FLOWING_WATER) worldIn.setBlockState(pos, state.with(InvisibleBlock.FLOWINGLOGGED, true), 3); + BlockState newState = state; + if (fluidStateIn.isTagged(FluidTags.WATER)) newState = newState.with(BlockStateProperties.WATERLOGGED, true); + else if (fluidStateIn.isTagged(FluidTags.LAVA)) newState = newState.with(InvisibleBlock.LAVALOGGED, true); + if (!fluidStateIn.isSource()) newState = newState.with(InvisibleBlock.FLOWINGLOGGED, true); + worldIn.setBlockState(pos, newState, Constants.BlockFlags.DEFAULT); worldIn.getPendingFluidTicks().scheduleTick(pos, fluidStateIn.getFluid(), fluidStateIn.getFluid().getTickRate(worldIn)); } - - return true; - } else if (state.get(InvisibleBlock.LAVALOGGED) && (fluid == Fluids.LAVA || fluid == Fluids.FLOWING_LAVA)) { - if (!worldIn.isRemote()) { - worldIn.setBlockState(pos, state.with(InvisibleBlock.LAVALOGGED, true), 3); - if (fluid == Fluids.FLOWING_LAVA) worldIn.setBlockState(pos, state.with(InvisibleBlock.FLOWINGLOGGED, true), 3); - worldIn.getPendingFluidTicks().scheduleTick(pos, fluidStateIn.getFluid(), fluidStateIn.getFluid().getTickRate(worldIn)); - } - return true; } else { return false; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 41517aa..70dd0c4 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -5,7 +5,7 @@ issueTrackerURL="https://github.com/North-West-Wind/MoreBoots/issues" [[mods]] modId="moreboots" -version="1.4.2" +version="1.5.0" displayName="More Boots" updateJSONURL="https://github.com/North-West-Wind/MoreBoots/raw/main/update.json" displayURL="https://github.com/North-West-Wind/MoreBoots" diff --git a/src/main/resources/assets/moreboots/blockstates/boots_invisible_placeholder.json b/src/main/resources/assets/moreboots/blockstates/boots_invisible_placeholder.json new file mode 100644 index 0000000..2c8f02f --- /dev/null +++ b/src/main/resources/assets/moreboots/blockstates/boots_invisible_placeholder.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "minecraft:block/air" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/moreboots/lang/en_us.json b/src/main/resources/assets/moreboots/lang/en_us.json index 71955b0..96c9cee 100644 --- a/src/main/resources/assets/moreboots/lang/en_us.json +++ b/src/main/resources/assets/moreboots/lang/en_us.json @@ -35,10 +35,13 @@ "item.moreboots.ka_boots": "Kill Aura Boots", "item.moreboots.glass_boots_empty": "Empty Glass Boots", "item.moreboots.glass_boots": "Glass Boots", + "item.moreboots.floatie_boots": "Floatie Boots", + "item.moreboots.strider_boots": "Strider Boots", "item.moreboots.quartz_ingot": "Quartz Ingot", "item.moreboots.metal_mix": "Metal Mix", "item.moreboots.bat_hide": "Bat Hide", + "item.moreboots.strider_foot": "Strider Foot", "block.moreboots.rainbow_wool": "Rainbow Wool", "block.moreboots.glowstone_dust": "Glowstone Dust Block", @@ -86,6 +89,8 @@ "tooltip.moreboots.ka_boots": "\u00A77\u00A7oHelps with your aim", "tooltip.moreboots.glass_boots_empty": "\u00A77\u00A7oFill with water to brew", "tooltip.moreboots.glass_boots": "\u00A77\u00A7oActs like potions but on feet", + "tooltip.moreboots.floatie_boots": "\u00A77\u00A7oFloats on water", + "tooltip.moreboots.strider_boots": "\u00A77\u00A7oWalks on lava", "itemGroup.morebootstab": "More Boots", "death.attack.stomp": "%1$s was stomped by %2$s", @@ -159,6 +164,10 @@ "advancements.moreboots.boot_recycler.description": "Craft the Boot Recycler to convert boots into energy.", "advancements.moreboots.glass_boots.title": "Permanent Effect", "advancements.moreboots.glass_boots.description": "Obtain the Glass Boots", + "advancements.moreboots.floatie_boots.title": "Jesus?", + "advancements.moreboots.floatie_boots.description": "Obtain the Floatie Boots", + "advancements.moreboots.strider_boots.title": "I Need Lava", + "advancements.moreboots.strider_boots.description": "Obtain the Strider Boots", "key.categories.moreboots": "More Boots", diff --git a/src/main/resources/assets/moreboots/models/item/floatie_boots.json b/src/main/resources/assets/moreboots/models/item/floatie_boots.json new file mode 100644 index 0000000..e926bd4 --- /dev/null +++ b/src/main/resources/assets/moreboots/models/item/floatie_boots.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "moreboots:items/floatie_boots" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/moreboots/models/item/strider_boots.json b/src/main/resources/assets/moreboots/models/item/strider_boots.json new file mode 100644 index 0000000..be783fe --- /dev/null +++ b/src/main/resources/assets/moreboots/models/item/strider_boots.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "moreboots:items/strider_boots" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/moreboots/models/item/strider_foot.json b/src/main/resources/assets/moreboots/models/item/strider_foot.json new file mode 100644 index 0000000..30c82b0 --- /dev/null +++ b/src/main/resources/assets/moreboots/models/item/strider_foot.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "moreboots:items/strider_foot" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/moreboots/textures/items/floatie_boots.png b/src/main/resources/assets/moreboots/textures/items/floatie_boots.png new file mode 100644 index 0000000..f8338d9 Binary files /dev/null and b/src/main/resources/assets/moreboots/textures/items/floatie_boots.png differ diff --git a/src/main/resources/assets/moreboots/textures/items/strider_boots.png b/src/main/resources/assets/moreboots/textures/items/strider_boots.png new file mode 100644 index 0000000..f3fe311 Binary files /dev/null and b/src/main/resources/assets/moreboots/textures/items/strider_boots.png differ diff --git a/src/main/resources/assets/moreboots/textures/items/strider_foot.png b/src/main/resources/assets/moreboots/textures/items/strider_foot.png new file mode 100644 index 0000000..408d2a3 Binary files /dev/null and b/src/main/resources/assets/moreboots/textures/items/strider_foot.png differ diff --git a/src/main/resources/assets/moreboots/textures/models/armor/floatie_layer_1.png b/src/main/resources/assets/moreboots/textures/models/armor/floatie_layer_1.png new file mode 100644 index 0000000..85c4f24 Binary files /dev/null and b/src/main/resources/assets/moreboots/textures/models/armor/floatie_layer_1.png differ diff --git a/src/main/resources/assets/moreboots/textures/models/armor/spruce_planks.png b/src/main/resources/assets/moreboots/textures/models/armor/spruce_planks.png new file mode 100644 index 0000000..7afbde7 Binary files /dev/null and b/src/main/resources/assets/moreboots/textures/models/armor/spruce_planks.png differ diff --git a/src/main/resources/assets/moreboots/textures/models/armor/strider.png b/src/main/resources/assets/moreboots/textures/models/armor/strider.png new file mode 100644 index 0000000..793b941 Binary files /dev/null and b/src/main/resources/assets/moreboots/textures/models/armor/strider.png differ diff --git a/src/main/resources/assets/moreboots/textures/models/armor/strider_layer_1.png b/src/main/resources/assets/moreboots/textures/models/armor/strider_layer_1.png new file mode 100644 index 0000000..4f6257e Binary files /dev/null and b/src/main/resources/assets/moreboots/textures/models/armor/strider_layer_1.png differ diff --git a/src/main/resources/data/moreboots/advancements/moreboots/floatie_boots.json b/src/main/resources/data/moreboots/advancements/moreboots/floatie_boots.json new file mode 100644 index 0000000..69daa14 --- /dev/null +++ b/src/main/resources/data/moreboots/advancements/moreboots/floatie_boots.json @@ -0,0 +1,36 @@ +{ + "parent": "moreboots:moreboots/root", + "display": { + "icon": { + "item": "moreboots:floatie_boots", + "nbt": "{Damage:0}" + }, + "title": { + "translate": "advancements.moreboots.floatie_boots.title" + }, + "description": { + "translate": "advancements.moreboots.floatie_boots.description" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "floatie_boots": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "moreboots:floatie_boots" + } + ] + } + } + }, + "requirements": [ + [ + "floatie_boots" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/moreboots/advancements/moreboots/strider_boots.json b/src/main/resources/data/moreboots/advancements/moreboots/strider_boots.json new file mode 100644 index 0000000..52f3c2b --- /dev/null +++ b/src/main/resources/data/moreboots/advancements/moreboots/strider_boots.json @@ -0,0 +1,36 @@ +{ + "parent": "moreboots:moreboots/floatie_boots", + "display": { + "icon": { + "item": "moreboots:strider_boots", + "nbt": "{Damage:0}" + }, + "title": { + "translate": "advancements.moreboots.strider_boots.title" + }, + "description": { + "translate": "advancements.moreboots.strider_boots.description" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "strider_boots": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "moreboots:strider_boots" + } + ] + } + } + }, + "requirements": [ + [ + "strider_boots" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/moreboots/recipes/floatie_boots.json b/src/main/resources/data/moreboots/recipes/floatie_boots.json new file mode 100644 index 0000000..43898e8 --- /dev/null +++ b/src/main/resources/data/moreboots/recipes/floatie_boots.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "#N#", + "###" + ], + "key": { + "#": { + "tag": "minecraft:planks" + }, + "N": { + "item": "minecraft:netherite_boots" + } + }, + "result": { + "item": "moreboots:floatie_boots", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/moreboots/recipes/strider_boots.json b/src/main/resources/data/moreboots/recipes/strider_boots.json new file mode 100644 index 0000000..e3aff95 --- /dev/null +++ b/src/main/resources/data/moreboots/recipes/strider_boots.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "#N#", + "###" + ], + "key": { + "#": { + "item": "moreboots:strider_foot" + }, + "N": { + "item": "minecraft:netherite_boots" + } + }, + "result": { + "item": "moreboots:strider_boots", + "count": 1 + } +} \ No newline at end of file diff --git a/update.json b/update.json index 4b9a770..9582cdd 100644 --- a/update.json +++ b/update.json @@ -9,7 +9,8 @@ "1.3.1": "Fixed flower pot not rendering", "1.4.0": "Week #4 Update", "1.4.1": "Fixed random crashes + ice not generating properly", - "1.4.2": "Fixed Bamboo Generation + Added Custom Warmth Effect" + "1.4.2": "Fixed Bamboo Generation + Added Custom Warmth Effect", + "1.5.0": "Week #5 Update" }, "1.16.3": { "1.0.0": "The very first release", @@ -20,7 +21,8 @@ "1.3.1": "Fixed flower pot not rendering", "1.4.0": "Week #4 Update", "1.4.1": "Fixed random crashes + ice not generating properly", - "1.4.2": "Fixed Bamboo Generation + Added Custom Warmth Effect" + "1.4.2": "Fixed Bamboo Generation + Added Custom Warmth Effect", + "1.5.0": "Week #5 Update" }, "1.16.2": { "1.0.0": "The very first release", @@ -31,7 +33,8 @@ "1.3.1": "Fixed flower pot not rendering", "1.4.0": "Week #4 Update", "1.4.1": "Fixed random crashes + ice not generating properly", - "1.4.2": "Fixed Bamboo Generation + Added Custom Warmth Effect" + "1.4.2": "Fixed Bamboo Generation + Added Custom Warmth Effect", + "1.5.0": "Week #5 Update" }, "1.16.1": { "1.0.0": "The very first release", @@ -42,16 +45,17 @@ "1.3.1": "Fixed flower pot not rendering", "1.4.0": "Week #4 Update", "1.4.1": "Fixed random crashes + ice not generating properly", - "1.4.2": "Fixed Bamboo Generation + Added Custom Warmth Effect" + "1.4.2": "Fixed Bamboo Generation + Added Custom Warmth Effect", + "1.5.0": "Week #5 Update" }, "promos": { - "1.16.4-latest": "1.4.2", - "1.16.4-recommended": "1.4.2", - "1.16.3-latest": "1.4.2", - "1.16.3-recommended": "1.4.2", - "1.16.2-latest": "1.4.2", - "1.16.2-recommended": "1.4.2", - "1.16.1-latest": "1.4.2", - "1.16.1-recommended": "1.4.2" + "1.16.4-latest": "1.5.0", + "1.16.4-recommended": "1.5.0", + "1.16.3-latest": "1.5.0", + "1.16.3-recommended": "1.5.0", + "1.16.2-latest": "1.5.0", + "1.16.2-recommended": "1.5.0", + "1.16.1-latest": "1.5.0", + "1.16.1-recommended": "1.5.0" } } \ No newline at end of file